Use `StarletteDeprecationWarning` instead of `DeprecationWarning`

Merged
KL
4mo ago
+22-12

Convert the remaining Starlette-emitted DeprecationWarnings to StarletteDeprecationWarning.

The StarletteDeprecationWarning class itself (and its use in TestClient for the httpx deprecation) already landed via #3291, so this PR only covers the leftover call sites: run_until_first_complete, starlette.middleware.wsgi, the lifespan deprecations in routing, the deprecated status constants, and the TestClient timeout argument. The filterwarnings entries are updated to match.

Rationale: a UserWarning subclass is visible by default, so deprecations reach users without them having to enable warnings explicitly. See https://sethmlarson.dev/deprecations-via-warnings-dont-work-for-python-libraries

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.