pytest-cov
pytest-cov copied to clipboard
omit from .coveragerc isn't working
On the configuration page in the documentation (https://pytest-cov.readthedocs.io/en/latest/config.html) it specifies how to omit tests/*
from coverage reporting.
Following the instructions exactly results in tests/*
still being covered.
What do you use exactly i.e. what is your .coveragerc
?
You likely are missing it in [report]
I guess.
Are the files reported to be covered in some way?
AFAIK omit
in [run]
should result in 0% coverage, but report
would still include it by default.
I think the docs could need an update then, and should also link to http://coverage.readthedocs.io/en/latest/config.html. Do you feel like creating a PR for this?
I'm seeing the same behavior:
.coveragerc
[report]
omit =
*/migrations/*.py
*/management/commands/*.py
*/admin.py
dubclub/settings/prod.py
dubclub/settings/next.py
dubclub/settings/demo.py
dubclub/settings/ui.py
dubclub/?sgi.py
All of the management/commands/*.py are listed as 0% coverage but the migrations were omitted
Turns out the command line had -omit
on it (for the migrations) and that made it ignore this option from the file. Re-running without the command line option made it work for me.