# httpx.ConnectError: All connection attempts failed (lifespan startup never executed)

- **ID:** `python/starlette-testclient-lifespan-not-run`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Using httpx.Client against app without running lifespan, so app.state resources (DB pool, clients) are None.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 0.100+ | active | — | — |
| 0.110+ | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   from starlette.testclient import TestClient
with TestClient(app) as client:  # 'with' runs lifespan
    r = client.get('/health')
   ```
2. **** (88% success)
   ```
   Use httpx.ASGITransport with lifespan='on' via asgi-lifespan LifespanManager.
   ```

## Dead Ends

- **** — Misses teardown; leaks resources and diverges from prod. (65% fail)
- **** — Still no lifespan; same None state. (85% fail)
