不能在Python单元测试rep上添加两次相同的度量值

2024-10-04 01:33:45 发布

您现在位置:Python中文网/ 问答频道 /正文

升级到以下版本后:

声纳5.2
声纳转轮2.4
Python插件1.5

当我在同一个包中有多个测试文件时,无法正确处理我的测试报告,例如:

测试注释_leitores.tests.NotasLeitoresModelsTest-20160107114942.xml
测试标记_leitores.tests.PaginaNotasLeitoresTest-20160107114942.xml

我得到了一个错误:

ERROR: Sonar During Error runner execution
ERROR: Unable to run Sonar
ERROR: Caused by: Can not add the same measure twice on org.sonar.api.resources.File@b497091[key=notas_leitores/tests.py,path=notas_leitores/tests.py,filename=tests.py,language=Python]: org.sonar.api.measures.Measure@27d4561[metricKey=skipped_tests,metric=Metric[id=<null>,key=skipped_tests,description=Number of skipped unit tests, type = INT, direction = -1, domain = Tests, name = Skipped unit tests,qualitative=true,userManaged=false,enabled=true,worstValue=<null>,bestValue=0.0,optimizedBestValue=true,hidden=false,deleteHistoricalData=false],value=0.0,data=<null>,description=<null>,alertStatus=<null>,alertText=<null>,date=<null>,variation1=<null>,variation2=<null>,variation3=<null>,variation4=<null>,variation5=<null>,url=<null>,characteristic=<null>,requirement=<null>,personId=<null>,persistenceMode=FULL,fromCore=false]

如果删除了这些测试结果,则正常进行分析。在

它可以在Sonar4.2和Python插件1.3中工作。在

我的声纳-项目.属性公司名称:

^{pr2}$

Tags: pyorg插件apifalsetruetestserror
1条回答
网友
1楼 · 发布于 2024-10-04 01:33:45

导入多个测试报告文件是有效的。但是,它们不应包含相同测试文件的结果(例如失败测试的数量)。 这是notas_leitores/tests.py的情况。SonarQube不接受这种情况:如果结果不同,哪一个是正确的?在

如果它与配置相同的SonarQube 4.2一起工作,我想这个旧版本不会执行相同的检查,因此不会向您显示您的设置有问题。在

相关问题 更多 >