# ImportError: No module named tests

- **ID:** `python/importerror-no-module-named-tests`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The test module or package is missing from the Python path, often due to incorrect directory structure or missing __init__.py.

## Version Compatibility

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

## Workarounds

1. **Ensure __init__.py exists in test directory** (90% success)
   ```
   touch tests/__init__.py
   ```
2. **Run pytest with PYTHONPATH set** (85% success)
   ```
   PYTHONPATH=. pytest
   ```

## Dead Ends

- **Adding sys.path.append manually** — Works temporarily but not portable; can cause path conflicts. (50% fail)
- **Installing tests as a package via pip** — Tests are not meant to be installed; they are run from source. (70% fail)
