# AssertionError: Dependency override for <function get_db at 0x...> was not applied; test used real database connection.

- **ID:** `python/fastapi-dependency-overrides-not-applied`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

app.dependency_overrides keyed on a different function object than the one used in the route (e.g., re-imported module or wrapped dependency).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 0.100.x | active | — | — |
| 0.110.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   from app.deps import get_db
app.dependency_overrides[get_db] = lambda: test_session
client = TestClient(app)
   ```
2. **** (90% success)
   ```
   Use `app.dependency_overrides.clear()` in teardown to avoid leakage between tests.
   ```

## Dead Ends

- **** — FastAPI requires the callable object, not its name. (95% fail)
- **** — TestClient uses the app passed to it; overrides elsewhere are ignored. (85% fail)
