Closed jaraco closed 1 year ago
I don't think you can avoid the allow list. Especially because it also tells coverage.py
how to match files under site-packages
to the ones under src/
.
The issue with tox was fixed in 7fe4ab8294a843622d20face7f9f6ccddb2d0a14.
I don't think you can avoid the allow list.
I'm pretty sure when I run coverage not using pytest-coverage, the additional files don't appear. It really shouldn't be necessary to exclude files in temporary directories from coverage... or to provide project-specific settings for a default configuration.
I think starting with coveragepy 5.3, the new source_pkgs
setting could be helpful in this case (needs testing tho)
From the docs:
source_pkgs (multi-string): a list of packages, the source to measure during execution. Operates the same as source, but only names packages, for resolving ambiguities between packages and directories.
This setting doesn't solve the problem, as it still requires every project to configure another setting. An allow list should not be necessary.
In #60, some common noise was removed, but some projects still get noise from other temporary files (pip-run, other pip temp dirs).
Maybe ask @nedbat for advice?
Don't want to bother Ned, because the issue is unique to pytest-cov.
This issue was addressed in #56.
Occasionally, but definitely not always, when pytest runs with pytest-cov as configured by this skeleton, the coverage report will include files not under test, including files under tox (despite the exclusion) and temp files created when running the tests. Consider this particularly egregious example from setuptools:
I'd like to find a solution that avoids requiring each project to create an allow-list of files to be included in coverage. It should be possible to discover the files for coverage just as it's possible to discover the files to test and exclude the rest.