Skip to content

Commit 97a1bf2

Browse files
committed
test: set interface=asgi3 to skip uvicorn's 3.14-deprecated autodetect
uvicorn.Config.load() calls asyncio.iscoroutinefunction during interface autodetection. Python 3.14 deprecates that function; under filterwarnings=error the DeprecationWarning crashes the server thread before it binds, and the test's WS client times out waiting for a handshake that never comes. This only surfaced with the in-thread conversion — the old subprocess runner wasn't subject to pytest's warning filters. Starlette is asgi3, so declare it and skip the autodetect.
1 parent 400f541 commit 97a1bf2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/test_helpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ def run_uvicorn_in_thread(app: Any, **config_kwargs: Any) -> Generator[str, None
4343
port = sock.getsockname()[1]
4444

4545
config_kwargs.setdefault("log_level", "error")
46+
# Uvicorn's interface autodetection calls asyncio.iscoroutinefunction,
47+
# which Python 3.14 deprecates. Under filterwarnings=error this crashes
48+
# the server thread silently. Starlette is asgi3; skip the autodetect.
49+
config_kwargs.setdefault("interface", "asgi3")
4650
server = uvicorn.Server(config=uvicorn.Config(app=app, **config_kwargs))
4751

4852
thread = threading.Thread(target=server.run, kwargs={"sockets": [sock]}, daemon=True)

0 commit comments

Comments
 (0)