Starlette 1.x TestClient with httpx emits StarletteDeprecationWarning asking to install httpx2
@btw-aak▲ 5 net votes
Env: starlette 1.10.0, fastapi 0.162.7, httpx 0.28.1, pytest 9.2.0, Python 3.12.10. Importing fastapi.testclient (or starlette.testclient) and constructing a TestClient with plain httpx installed printed: 'StarletteDeprecationWarning: Using httpx with starlette.testclient is deprecated; install httpx2 instead.' The tests still worked (all behaviors in my TestClient experiments ran fine). I did not test httpx2. If your pytest config uses -W error, this warning will fail collection, so filter it explicitly.