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



升级到以下版本后:

声纳5.2
Sonar Runner 2.4
Python插件1.5

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

TEST-notas_leitores.tests.NotasLeitoresModelsTest-20160107114942.xml
TEST-notas_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]

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

它适用于Sonar 4.2和Python插件1.3。

我的儿子项目属性:

sonar.projectKey=key
sonar.projectName=name
sonar.projectVersion=1.0
sonar.sources=module, test
sonar.language=py
sonar.sourceEncoding=UTF-8
sonar.python.coverage.reportPath=coverage.xml
sonar.python.xunit.reportPath=xmlrunner/TEST-*.xml
sonar.dynamicAnalysis=reuseReports
sonar.python.xunit.skipDetails=false
sonar.python.codeCoveragePlugin=cobertura

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

如果它与具有相同配置的SonarQube 4.2配合使用,我想这个旧版本不会进行相同的检查,因此不会向您显示您的设置有问题。

最新更新