pytest-dev / pytest-cov

Coverage plugin for pytest.
MIT License
1.72k stars 211 forks source link

cov-fail-under should round before comparing #601

Open bthorben opened 1 year ago

bthorben commented 1 year ago

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 1 year ago

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

bthorben commented 1 year ago
FAIL Required test coverage of 54.18% not reached. Total coverage: 54.18%

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

nedbat commented 1 year ago

No, you're good, my mistake.

didibz-harmonya commented 11 months ago

This PR should solve this reporting issue.