声纳Python覆盖报告问题

声纳Python覆盖报告问题,python,sonarqube,Python,Sonarqube,Sonar无法显示Cobertura生成的Python模块的代码覆盖率。我目前正在使用詹金斯与声纳进行构建和集成。我的声纳特性是: # Info required for Sonar sonar.sources=module sonar.language=py # Additional Configuration sonar.python.xunit.reportPath=**/nosetests.xml sonar.python.coverage.reportPath=**/coverage

Sonar无法显示Cobertura生成的Python模块的代码覆盖率。我目前正在使用詹金斯与声纳进行构建和集成。我的声纳特性是:

# Info required for Sonar
sonar.sources=module
sonar.language=py

# Additional Configuration
sonar.python.xunit.reportPath=**/nosetests.xml
sonar.python.coverage.reportPath=**/coverage.xml
控制台输出显示:

12:03:26.458 INFO  - Sensor PythonXunitSensor...
12:03:27.305 INFO  - Processing report 'nosetests.xml'
12:03:27.305 INFO  - Parsing report 'nosetests.xml'
12:03:27.460 INFO  - Sensor PythonXunitSensor done: 1002 ms
12:03:27.460 INFO  - Sensor PythonCoverageSensor...
12:03:28.216 INFO  - Parsing report 'coverage.xml'
12:03:28.269 INFO  - Sensor PythonCoverageSensor done: 809 ms
12:03:28.269 INFO  - Sensor CpdSensor...
12:03:28.270 INFO  - SonarBridgeEngine is used
12:03:28.426 INFO  - Cross-project analysis disabled
12:03:29.181 INFO  - Sensor CpdSensor done: 912 ms
但在Sonar中,我只看到单元测试结果,没有覆盖率数据,当我使用debug选项运行时,它会说:

16:51:23.124 DEBUG - Cannot find the file , ignoring coverage measures
16:51:23.125 DEBUG - Cannot find the file , ignoring coverage measures
16:51:23.125 DEBUG - Cannot find the file , ignoring coverage measures
16:51:23.126 DEBUG - Cannot find the file , ignoring coverage measures
16:51:23.126 DEBUG - Cannot find the file , ignoring coverage measures

我也检查了案例和路径,但没有发现问题。有人能帮我吗?

我遇到了类似的问题。coverage.xml文件中的路径错误,我只是运行了一个sed命令来替换所有文件路径以添加模块目录。

尝试将
sonar.python.coveragePlugin=cobertura
添加到您的sonar属性中,然后再次运行。

我遇到了类似的问题,并在coverage.xml中发现了路径问题。在运行SED(SED的/filename\=\“/filename\=\“myprefix\//g”target/reports/coverage.xml)之后,sonar runner向Sonarqu发布了覆盖率报告。有人知道“声纳赛跑者”是否已经找到了解决办法吗?理想情况下,我们不需要在构建中使用sed黑客。声纳跑步者应识别/解析路径。