I can’t seem to make the code coverage results appear in the Code Quality, Quality Gate section of the PR in bitbucket.
the coverage report is generated before the scanner runs
I used pytest-cov to generate the report which generates the report
report generated is of xml format as the documentation required
the coverage report generated is valid as I printout the contents during the build
I used -Dsonar.python.coverage.reportPaths to somehow force sonar to view the generated report but it still won’t reflect in Quality Gate
Still with the reportPaths arg, I tried to put in **/coverage.xml so it won’t matter which folder it is in as long as the name match, but it still won’t work.
I also tried generated the report, coverage.xml, to the root and setting this as an arg -Dsonar.python.coverage.reportPaths=coverage.xml but it also still won’t work
Can you please suggest other items that I can check or am I doing something wrong?
so we have a step that runs the test and generates the coverage report. we use pytest for test execution and coverage report generation.
for the logs, here’s what I get. it does appear that the file is not being scanned for some reason but it is a bit confusing since I’m able to check the file, it exists and I can see the contents of the file.
13:12:18.223 INFO: Sensor Cobertura Sensor for Python coverage [python]
13:12:18.224 DEBUG: Using pattern 'coverage.xml' to find reports
13:12:18.261 WARN: No report was found for sonar.python.coverage.reportPaths using pattern coverage.xml
13:12:18.261 INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=38ms
I would assume that you aren’t actually sharing the artifact produced in the other step so that it’s accessible to the sonarsource/sonarcloud-scan. For example: if you ran cat coverage.xml before the pipe: