# CoverageWarning: No data was collected. (no-data-collected)
WARNING: Failed to find data for module 'myapp'

- **ID:** `python/pytest-coverage-no-data-collected`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

coverage run was pointed at the wrong source, or pytest is executed under a different interpreter/subprocess than the one coverage instruments. Common when using pytest-xdist without --cov or when tests spawn subprocesses that coverage does not trace.

## Version Compatibility

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

## Workarounds

1. **** (94% success)
   ```
   pip install pytest-cov
pytest --cov=myapp --cov-report=term-missing -n auto
   ```
2. **** (85% success)
   ```
   # .coveragerc
[run]
concurrency = multiprocessing
parallel = True
source = myapp
   ```

## Dead Ends

- **** — Broadens the source but if coverage is not started under the same process, still collects nothing. (70% fail)
- **** — Correct in principle, but if pytest-xdist is active the workers are separate processes and the main process records no data. (65% fail)
