# import file mismatch:
  /app/tests/test_models.py has this __file__ attribute:
    /app/tests/test_models.py
  which is not the same as the test file we want to collect:
    /app/tests/unit/test_models.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules

- **ID:** `python/pytest-import-mismatch-missing-init`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Two test files share the same basename (test_models.py) in different directories, but neither directory is a Python package (no __init__.py), so pytest imports both as top-level module `test_models`, causing a collision.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   touch tests/__init__.py tests/unit/__init__.py
# pytest then imports as tests.test_models and tests.unit.test_models
   ```
2. **** (90% success)
   ```
   mv tests/test_models.py tests/test_api_models.py
mv tests/unit/test_models.py tests/unit/test_db_models.py
   ```
3. **** (85% success)
   ```
   # pytest.ini
[pytest]
addopts = --import-mode=importlib
   ```

## Dead Ends

- **** — Clearing caches removes stale bytecode but does not fix the underlying module-name collision; the error reappears on the next run. (85% fail)
- **** — Changing PYTHONPATH does not give the two files distinct module names; the collision is due to identical basenames without package context. (90% fail)
