Coverage.xml does not get created correctly, and hence Sonarqube scanner fails during parsing

Hello,
I have a Jenkins setup with Sonarqube integration.
For one of my applications, coverage.xml gets created with
class name=“src/app/project/filexyz.py” complexity=“0” line-rate=“0.7078” branch-rate=“0”
pytest report looks for name=filexyz.py, does not find it and fails with a Null Pointer Exception -
INFO: Parsing report ‘path/coverage.xml’
17:55:34.956 INFO: ------------------------------------------------------------------------
17:55:34.956 INFO: EXECUTION FAILURE
17:55:34.956 INFO: ------------------------------------------------------------------------
These are the pytest and coverage commands that are used
coverage erase
coverage run -m pytest -x ${PROJECT_ROOT}/src/app/tests/unit_tests/ -vv --cache-clear -rxXs --junitxml=pytest-report.xml
coverage report
coverage xml -i
Other apps using the same Jenkinsfile and coverage commands, and the same line in coverage.xml looks like this -
class branch-rate=“0” complexity=“0” filename=“src/app/project/filexyz.py” line-rate=“1” name=“filexyz.py”
Here, the name is explicit and so , it can be compared with the entries in pytest-report.

Any pointers as to why the different xml formats for the same code?
Thanks

Hi @v_g ,
First sorry for being so late, we somehow missed this thread.
Do you have still the problem? If yes, could you please add debug log of the analysis?

You might find useful this guide about adding coverage in SonarCloud (which should be quite similar for SonarQube) Python Test Coverage | SonarCloud Docs

Thanks!