# no tests ran in 0.12s
ERROR: file or directory not found: tests/test_api.py

- **ID:** `python/pytest-exit-code-5-no-tests-collected`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The path passed to pytest does not exist relative to the current working directory, or the test file was renamed/moved. pytest exits with code 5 (EXIT_NOTESTSCOLLECTED) when no tests are collected.

## Version Compatibility

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

## Workarounds

1. **** (92% success)
   ```
   cd /app && pytest
   ```
2. **** (88% success)
   ```
   test -f tests/test_api.py && pytest tests/test_api.py || echo 'missing test file'
   ```

## Dead Ends

- **** — Ignoring the directory means the intended tests never run; the CI job passes green while testing nothing. (90% fail)
- **** — Masks genuinely missing tests and broken collection, allowing regressions through. (85% fail)
