# FAIL Required test coverage of 90% not reached. Total coverage: 84.32%
ERROR: Coverage failure: total of 84.32 is less than fail-under=90.00

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

## Root Cause

pytest-cov's --cov-fail-under threshold is higher than the actual measured coverage. Common when new code was added without tests, or when source paths in --cov are misconfigured so some modules show as 0%.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 5.0 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   pytest --cov=src --cov-report=term-missing --cov-fail-under=0
# then write tests for the missing lines, or:
pytest --cov=src --cov-report=html
open htmlcov/index.html
   ```
2. **** (90% success)
   ```
   pytest --cov=src --cov-fail-under=90 \
  --cov-config=.coveragerc

# .coveragerc
[run]
omit =
    */migrations/*
    */tests/*
    */conftest.py
   ```

## Dead Ends

- **** — Treats the symptom; coverage continues to drift downward and the team loses the safety net. (75% fail)
- **** — Excludes code from measurement instead of testing it; reviewers reject the PR and real bugs ship untested. (80% fail)
