coverage.py will include init.py in its report and show it as 0 lines, but with 100% coverage.
I want to exclude all blank files from coverage report. I can't just add */__init__.py
to omit
as some of my __init__.py
files have code.
From the docs and docs: "New in version 5.0: The contexts
and skip_empty
parameters." In your tox.ini
file or .coveragerc
file add the following:
[coverage:report] skip_empty = true
"If skip_empty is true, don’t report on empty files (those that have no statements)."
"skip_empty (boolean, default False): Don’t include empty files (those that have 0 statements) in the report. See Coverage summary for more information."
This feature doesn't exist in coverage.py. Does it help that you can sort the HTML report to move 100% files to the bottom, or files with 0 statements to the bottom?
UPDATE: As of coverage.py 4.0, the --skip-covered
option is available to do exactly what is requested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With