gpt4 book ai didi

python - Sonar Python 覆盖率报告问题

转载 作者:太空宇宙 更新时间:2023-11-03 18:48:30 26 4
gpt4 key购买 nike

Sonar 无法显示 Cobertura 生成的 Python 模块的代码覆盖率。我目前正在使用 Jenkins 进行构建并与 Sonar 集成。我的 Sonar 属性是:

# 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 中,我只看到单元测试结果,但看不到覆盖数据,当我使用调试选项运行时,它显示:

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 命令来替换所有文件路径以添加模块目录。

关于python - Sonar Python 覆盖率报告问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18923204/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com