Open
Description
Summary
When trying to get coverage on something like myproject
, while also running a warning filter on a warning within that project, say myproject.MyWarning
coverage is started too late. For example:
python -m pytest -W error::myproject.MyWarning --cov=myproject tests/
will result in myproject
being imported (to get MyWarning
), before pytest-cov starts coverage. Any imports (and code that runs at import time) as a results of importing myproject
will be missed. You do get the warning: Coverage.py warning: Module myproject was previously imported, but not measured (module-not-measured)
I'm not sure if anything can be done about it (since pytest is the one controlling when warning filters are set up), but at the very least it would be great to put this as a gotcha in the docs somewhere.
Metadata
Metadata
Assignees
Labels
No labels