pytest-dev/pytest-cov

cov-fail-under should round before comparing

bthorben opened this issue · 4 comments

Summary

Our tests fail with a message similar to
FAIL Required test coverage of 54.18% not reached. Total coverage: 54.18%
as you can see from this message, it actually looks like the coverage is reached. It should only fail if the coverage is less, not if it's equal.

My guess is that these numbers are rounded and are actually not equal.

Expected vs actual result

Actual: Fails when coverage is qual expected value
Expected: Only fail if it is less

Reproducer

Versions

pytest-cov==4.1.0
pytest==7.3.2

nedbat commented

Can you show us the exact actual message you are seeing?

FAIL Required test coverage of 54.18% not reached. Total coverage: 54.18%

is the actual message, nothing else. Maybe I misunderstood?!

nedbat commented

No, you're good, my mistake.

This PR should solve this reporting issue.