Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cov-fail-under should round before comparing #601

Open
bthorben opened this issue Jun 27, 2023 · 4 comments
Open

cov-fail-under should round before comparing #601

bthorben opened this issue Jun 27, 2023 · 4 comments

Comments

@bthorben
Copy link

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
Copy link
Collaborator

nedbat commented Jun 27, 2023

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

@bthorben
Copy link
Author

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

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

@nedbat
Copy link
Collaborator

nedbat commented Jun 27, 2023

No, you're good, my mistake.

nedbat added a commit to nedbat/coveragepy that referenced this issue Jun 27, 2023
I saw this bug against pytest-cov, and thought it was my fault:
pytest-dev/pytest-cov#601, but pytest-cov has
their own comparison and reporting code for fail-under.  Without the
plugin, you won't get a message like "total of X is less than X."  This
test helped confirm that, so we'll keep it.
nedbat added a commit to nedbat/coverage-reports that referenced this issue Jun 27, 2023
I saw this bug against pytest-cov, and thought it was my fault:
pytest-dev/pytest-cov#601, but pytest-cov has
their own comparison and reporting code for fail-under.  Without the
plugin, you won't get a message like "total of X is less than X."  This
test helped confirm that, so we'll keep it.

https://htmlpreview.github.io/?https://github.com/nedbat/coverage-reports/blob/main/reports/20230627_44aa528a44/htmlcov/index.html
44aa528a44: master
nedbat added a commit to nedbat/coveragepy that referenced this issue Jun 27, 2023
I saw this bug against pytest-cov, and thought it was my fault:
pytest-dev/pytest-cov#601, but pytest-cov has
their own comparison and reporting code for fail-under.  Without the
plugin, you won't get a message like "total of X is less than X."  This
test helped confirm that, so we'll keep it.
nedbat added a commit to nedbat/coveragepy that referenced this issue Jun 27, 2023
I saw this bug against pytest-cov, and thought it was my fault:
pytest-dev/pytest-cov#601, but pytest-cov has
their own comparison and reporting code for fail-under.  Without the
plugin, you won't get a message like "total of X is less than X."  This
test helped confirm that, so we'll keep it.
nedbat added a commit to nedbat/coveragepy that referenced this issue Jun 28, 2023
I saw this bug against pytest-cov, and thought it was my fault:
pytest-dev/pytest-cov#601, but pytest-cov has
their own comparison and reporting code for fail-under.  Without the
plugin, you won't get a message like "total of X is less than X."  This
test helped confirm that, so we'll keep it.
nedbat added a commit to nedbat/coveragepy that referenced this issue Jun 28, 2023
I saw this bug against pytest-cov, and thought it was my fault:
pytest-dev/pytest-cov#601, but pytest-cov has
their own comparison and reporting code for fail-under.  Without the
plugin, you won't get a message like "total of X is less than X."  This
test helped confirm that, so we'll keep it.
nedbat added a commit to nedbat/coveragepy that referenced this issue Jun 28, 2023
I saw this bug against pytest-cov, and thought it was my fault:
pytest-dev/pytest-cov#601, but pytest-cov has
their own comparison and reporting code for fail-under.  Without the
plugin, you won't get a message like "total of X is less than X."  This
test helped confirm that, so we'll keep it.
nedbat added a commit to nedbat/coveragepy that referenced this issue Jun 28, 2023
I saw this bug against pytest-cov, and thought it was my fault:
pytest-dev/pytest-cov#601, but pytest-cov has
their own comparison and reporting code for fail-under.  Without the
plugin, you won't get a message like "total of X is less than X."  This
test helped confirm that, so we'll keep it.
@didibz-harmonya
Copy link

This PR should solve this reporting issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants