Python Coverage File Not Found

  • ALM used: GitHub
  • CI system used: Github Actions
  • Scanner command used: Automatic Analysis on PR
  • Languages of the repository: Python
  • Only if the SonarCloud project is public, the URL
  • Error observed:
    • I’ve seen a few posts like this so apologies for adding another to the pile; I wasn’t able to get things working following along. My coverage.xml is being created during CI and pushed back to the branch. The file is being created and added as expected, Coverage XML written to file tests/_coverage/coverage.xml, but SonarCloud doesnt seem to find it. I’ve specified the path in the file with sonar.python.coverage.reportPaths=**/tests/_coverage/*.xml. I’ve tried a few combinations



# This is the name and version displayed in the SonarCloud UI.

# Path is relative to the file. Replace "\" by "/" on Windows.

# Encoding of the source code. Default is default system encoding

# other

Any ideas or suggestions?

Hello @snayff and welcome to our community,

Unfortunately, importing coverage information is not yet supported when using automatic analysis (see current limitations in the doc:

As I see you are using Github Actions, you can however instead use the SonarCloud Github Action in your GitHub workflow to circumvent this limitation.

Hope that helps,


Ah, OK, thank you! So I have tried to use the Action but am currently finding that the directories specified in the are not found. I’ve tried setting the projectBaseDir to . as I thought that might be it.

Caused by: The folder 'tests/**' does not exist for 'Snayff_notquiteparadise' (base directory = /github/workspace)

Full log here:

Am I missing something?

I’ve gone back to automatic analysis and used something else for coverage.


I’m glad you found another workaround to your problem. For the record, I’ll try to give you pointers into getting this to work entirely with SonarCloud.

In the last example, your properties settings seem a bit weird to me.
You have this error in your logs:
10:17:11.703 ERROR: Invalid value of sonar.tests for Snayff_notquiteparadise

Also I believe if you want to refer to a folder, you don’t need to add /** at its end, as the subdirectories are automatically included.

So my suggestion would be to try to replace sonar.test.inclusions=tests/** with sonar.tests=tests instead.

If you do that, when importing your code coverage, you might also encounter a problem with incorrect file paths in your coverage file, which you can fix following the advice from this thread:

Here’s a sample Python project that deals with this:

Hope that helps,


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