# ERROR: found no collectors
ImportError while importing test module 'tests/test_api.py'.
Hint: make sure your test modules/packages have valid Python names.
ModuleNotFoundError: No module named 'myapp'

- **ID:** `python/pytest-collection-import-mismatch-src-layout`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The project uses a src/ layout and the package is not on sys.path because it has not been installed (pip install -e .) and pytest's rootdir does not include src/.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   pip install -e .
# or with pyproject.toml
pip install -e '.[dev]'
pytest -q
   ```
2. **** (90% success)
   ```
   # pyproject.toml
[tool.pytest.ini_options]
pythonpath = ['src']
testpaths = ['tests']
   ```

## Dead Ends

- **** — Duplicates boilerplate across files, breaks when tests run from a different cwd, and hides packaging bugs. (55% fail)
- **** — Not persisted for CI or other contributors; failures reappear in fresh environments. (50% fail)
