coveragepy
coveragepy copied to clipboard
Missing package with duplicate name in coverage-xml
I've noticed that files / a package is missing in coverage.xml
(via coverage xml
), but not with coverage report
.
I have project/settings/__init__.py
and testing/settings/__init__.py
, but only the latter is in coverage.xml
.
This appears to get triggered by specifying sources explicitly:
source = project, testing/
Resulting in:
<coverage version="6.2" …>
<sources>
<source>…/project/app</source>
<source>…/project/testing</source>
</sources>
<packages>
…
<package name="settings" …>
<classes>
<class name="__init__.py" filename="settings/__init__.py" complexity="0" line-rate="1" branch-rate="1">
<methods/>
<lines/>
</class>
When using source = .
instead I get "settings" twice:
<coverage version="6.2" …>
<sources>
<source>…/project</source>
</sources>
<packages>
…
<package name="project.settings" …>
…
<package name="testing.settings" …>
The workaround of using source = .
is good enough for me, and results in a better "coverage.xml" altogether, but I think that is is a bug nonetheless, and likely related to having the package as a key somewhere, so the latter overrides the former.