# CoverageWarning: Module myapp was never imported. (module-not-imported)
CoverageWarning: No data was collected. (no-data-collected)

- **ID:** `python/pytest-coverage-source-missing`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

pytest-cov was pointed at a source path that doesn't match the importable package name, or tests never import the package (e.g., only test submodules that import a different top-level name).

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   pytest --cov=myapp --cov-report=term-missing tests/
   ```
2. **** (92% success)
   ```
   # pyproject.toml
[tool.coverage.run]
source = ["myapp"]
branch = true
   ```
3. **** (85% success)
   ```
   # tests/conftest.py
import myapp  # noqa: F401 ensures coverage sees the package
   ```

## Dead Ends

- **** — Branch coverage doesn't fix missing source mapping. (90% fail)
- **** — Threshold doesn't affect data collection. (90% fail)
- **** — Extra deps don't fix path/name mismatch. (85% fail)
