pytest-dev / pytest-cov

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

"Fail under check" is failing because of ignoring the precession config #638

Open tanaydin opened 4 months ago

tanaydin commented 4 months ago

I'm configuring coverage report in pyproject.toml like

[tool.coverage.report]
precision = 1

and trying to get json report with fail-under configured like

poetry run pytest --cov --cov-append --cov-fail-under=80.2 --cov-report=json

but in the following check, it's failing https://github.com/pytest-dev/pytest-cov/blob/5295ce01c84262cec88f31255e9ac538718f3047/src/pytest_cov/plugin.py#L380

as

FAIL Required test coverage of 80.2% not reached. Total coverage: 80.16%

Because self.cov_total is something like 80.1634243243 it should be rounding 80.16 to 80.20 and pass.