pytest-cov icon indicating copy to clipboard operation
pytest-cov copied to clipboard

cov-fail-under should round before comparing

Open bthorben opened this issue 2 years ago • 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

bthorben avatar Jun 27 '23 08:06 bthorben

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

nedbat avatar Jun 27 '23 11:06 nedbat

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

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

bthorben avatar Jun 27 '23 12:06 bthorben

No, you're good, my mistake.

nedbat avatar Jun 27 '23 13:06 nedbat

This PR should solve this reporting issue.

didibz-harmonya avatar Sep 19 '23 12:09 didibz-harmonya