# ValueError: No tests were collected. Ensure test files start with 'test_' or end with '_test.py'.

- **ID:** `python/valueerror-no-tests-collected`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Pytest or unittest cannot find test files because they do not follow the default naming conventions.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |

## Workarounds

1. **Rename test files to match pattern** (95% success)
   ```
   mv my_tests.py test_my_tests.py
   ```
2. **Use pytest --collect-only to debug discovery** (90% success)
   ```
   pytest --collect-only -v
   ```

## Dead Ends

- **Creating test files with arbitrary names** — Pytest only discovers files matching patterns like test_*.py or *_test.py. (80% fail)
- **Running pytest from wrong directory** — If tests are in a subdirectory, pytest must be run from the root or with --rootdir. (60% fail)
