Closed
Description
Describe the bug
If I have a file with no statements, coverage report
correctly says that the coverage is 100%. However, coverage report --fail-under 100
will fail because it thinks the coverage is 0%.
To Reproduce
- Use Python 3.10
- Use Coverage 6.4.4 with C extension
$ touch test.py
$ coverage run test.py
$ coverage report
Name Stmts Miss Cover
-----------------------------
test.py 0 0 100%
-----------------------------
TOTAL 0 0 100%
$ echo $?
0
$ coverage report --fail-under 100
Name Stmts Miss Cover
-----------------------------
test.py 0 0 100%
-----------------------------
TOTAL 0 0 100%
Coverage failure: total of 0 is less than fail-under=100
$ echo $?
2
Expected behavior
I would expect this to succeed with no error, it says right above that the coverage is 100%, but then claims it's 0% when --fail-under
is supplied.