I am running a pipeline from Azure DevOps and cannot get test coverage statistics in SonarCloud. I am running the pytest step by:
pip install pytest &&
pytest --cov-report term-missing --cov=Server UnitTest/Server --doctest-modules --junitxml=junit/server-test-results.xml &&
pytest --cov-report term-missing --cov=Common UnitTest/Common --doctest-modules --junitxml=junit/common-test-results.xml
and my sonar-project.properties lists
sonar.python.coverage.reportPaths=**/*test-results.xml
sonar.python.xunit.skipDetails=true
When the SonarScan step in my pipeline runs I see it finds the pytest coverage reports
INFO: Sensor Cobertura Sensor for Python coverage [python]
INFO: Python test coverage
INFO: Parsing report '/home/vsts/work/21/s/junit/common-test-results.xml'
INFO: Parsing report '/home/vsts/work/21/s/junit/server-test-results.xml'
INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=106ms
INFO: Sensor PythonXUnitSensor [python]
INFO: Sensor PythonXUnitSensor [python] (done) | time=49ms
but the Sonar coverage report says there is 0% coverage of the code. I have been researching this for a while and gone through the documentation and posts in the community which have led me to the current status of my sonar-project.properties
file, but I still cannot see the test coverage being reported correctly.