coveragepy icon indicating copy to clipboard operation
coveragepy copied to clipboard

Missing package with duplicate name in coverage-xml

Open blueyed opened this issue 3 years ago • 0 comments

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.

blueyed avatar Dec 13 '21 16:12 blueyed