Python coverage shows 0%

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
    ** SonarQube : Enterprise Edition Version 8.4.2 (build 36762)
    ** Scanner : SonarScanner 4.5.0.2216
    ** Python : 3.8.0
    ** Python coverage : version 5.0.4 with C extension

  • error observed (wrap logs/code around triple quote ``` for proper formatting)
    ** The project still show 0% coverage, even I have configured the coverage.xml for the scanner
    ** Please check the coverage xml i had
    coverage.xml.txt (88.0 KB)
    ** Also my sonar settings :
    sonar-project.properties.txt (118 Bytes)

  • steps to reproduce
    The log are like following :
    INFO: Starting rules execution
    INFO: 28 source files to be analyzed
    INFO: 28/28 source files have been analyzed
    INFO: Sensor Python Sensor [python] (done) | time=9663ms
    INFO: 28/28 source files have been analyzed
    INFO: Sensor Cobertura Sensor for Python coverage [python]
    INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=1739ms

And the full log can be found here sonar.log (7.7 KB)

  • potential workaround

Hello @kzhou57 and welcome to this community,

From what I can see, there seems to be a mistake in your sonar-project.properties: the property to import Python coverage reports should be sonar.python.coverage.reportPaths rather than sonar.sonar.python.coverage.reportPaths.

Can you try again with the correct property name and see if it works?

Hope that helps,
Guillaume

1 Like

Yes, you are absolutely right ! And I don’t why I didn’t see this obvious issue.

Thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.