Closed remram44 closed 3 years ago
This is fixed in commit 1a6844ae.
This is now released as part of coverage 6.1.1.
I am still getting already-imported errors with namespace packages in coverage 6.3.2.
Looking at the fix provided in commit 1a6844a I see the module path array len is checked for >1, however when I insert some debug statements into that file my module paths are always an array of length 1, failing the test and producing the warning. Changing the check to >0 does eliminate the warning, although I am unfamiliar with the module attributes and if this is a valid change.
Describe the bug
When using namespace packages (declared through
setup.py
asnamespace_packages=[...]
) coverage shows warnings "Already imported a file that will be measured" for the__init__.py
files.Those files simply contain the
declare_namespace()
call:To Reproduce How can we reproduce the problem? Please be specific.
coverage run --source=/tmp/testcov/app,/tmp/testcov/plugin app/testcov/main.py
(seerun.sh
in repo)Expected behavior
I didn't expect to see a warning.
Additional context This problem was uncovered in ReproZip: https://travis-ci.org/VIDA-NYU/reprozip/jobs/625416082#L4117
Documentation on namespace packages with pkg_resources: https://packaging.python.org/guides/packaging-namespace-packages/#pkg-resources-style-namespace-packages