# fixture 'db_session' not found

- **ID:** `python/fixturenotfounderror-fixture-not-found`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Pytest cannot locate a fixture because it is not defined, imported, or spelled incorrectly in the test function.

## Version Compatibility

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

## Workarounds

1. **Define fixture in conftest.py at the appropriate level** (95% success)
   ```
   # conftest.py
@pytest.fixture
def db_session():
    return create_session()
   ```
2. **Use @pytest.fixture decorator in test file** (90% success)
   ```
   @pytest.fixture
def db_session():
    return create_session()
   ```

## Dead Ends

- **Defining fixture in the same file but with wrong name** — Fixture name must match exactly; typos cause not found errors. (70% fail)
- **Using fixture from conftest without importing** — conftest fixtures are automatically available, but only if conftest is in the correct directory. (50% fail)
