python
config_error
ai_generated
true
FAIL Required test coverage of 80% not reached. Total coverage: 75.00%
ID: python/pytest-cov-fail-under
80%Fix Rate
87%Confidence
0Evidence
2025-08-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
The test suite's coverage is below the threshold set by --cov-fail-under. This causes pytest to exit with a non-zero status, failing CI.
generic中文
测试套件的覆盖率低于 --cov-fail-under 设置的阈值。这导致 pytest 以非零状态退出,使 CI 失败。
Workarounds
-
95% success
Use coverage report to identify missing lines: coverage report -m Then add tests targeting those lines.
-
90% success
In .coveragerc: [run] omit = */tests/* */migrations/* -
80% success
Use # pragma: no branch for branches that are impossible to test.
Dead Ends
Common approaches that don't work:
-
70% fail
This may pass CI but reduces the quality gate, allowing coverage to drop further over time.
-
90% fail
This disables the coverage check entirely, eliminating the quality gate.
-
95% fail
This is a form of cheating and may hide genuinely untested code.