# FAIL Required test coverage of 80% not reached. Total coverage: 74.31%

- **ID:** `python/pytest-cov-fail-under-missing`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

pytest-cov --cov-fail-under compares total coverage against the threshold. Coverage is computed on the whole package, including files not exercised by the current test subset.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 5.x | active | — | — |
| 6.x | active | — | — |

## Workarounds

1. **** (85% success)
   ```
   Scope coverage to changed files in CI:

pytest --cov=app --cov-fail-under=80 --cov-report=term-missing
   ```
2. **** (90% success)
   ```
   Use diff-cover to enforce coverage only on new lines:

diff-cover coverage.xml --compare-branch=origin/main --fail-under=80
   ```

## Dead Ends

- **** — Excludes real code from coverage and hides untested paths rather than testing them. (85% fail)
- **** — Disables the gate entirely and lets coverage regress silently. (90% fail)
