I am having an issue where SonarQube shows 0% code coverage for my Python project.
- SonarQube: 7.9.3 - Sonar server platform: OpenShift 3.11 - Python version: 3.6.8 - SonarScanner 188.8.131.520 - Java 11.0.8 N/A (64-bit) - Mac OS X 10.15.6 x86_64
I am using pytest to run the tests, currently I have 163 tests, all passed. I use the Python coverage package to generate an HTML report for easier visualization, and it reports 81% coverage. However, when I run sonar-scanner it says that it successfully parses the report.xml file yet still shows 0% code coverage on the server.
Here is my sonar-project.properties file:
sonar.projectKey=brandi-flaskql sonar.language=python sonar.sources=./app sonar.tests=./tests sonar.python.coverage.reportPaths=tests/*.xml sonar.projectVersion=1.0.4
I added the -X flag to sonar-scanner to output a more detailed log, I have the full output saved but here are what I consider the relevant lines (full log file attached):
DEBUG: Using pattern 'tests/*.xml' to find reports INFO: Python test coverage INFO: Parsing report '/Users/mitchellmurphy/Developer/SpatheSystems/brandi-flaskql/tests/report.xml' INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=126ms
sonar-debug.log (63.7 KB)