From a5255ec984098579d400a631fdf3a2571cb0ca79 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Fri, 4 Sep 2026 01:47:26 +0200 Subject: test: add pytest-timeout and pin the Windows selector event loop A hung test could wedge the whole run: aiortc's ICE stack never completes a loopback DataChannel handshake on Windows' default ProactorEventLoop, and nothing capped it. Two changes, both no-ops off Windows: - `timeout = 60` in the root pytest config (+ pytest-timeout in the dev extras) so a stall fails the test instead of the suite. - a root conftest that selects WindowsSelectorEventLoopPolicy on win32 only, which is what aiortc needs there. Trade-off, documented: the selector loop cannot spawn subprocesses on Windows, so the ffmpeg streaming tests fail there rather than pass -- they need a per-module override or skipif(win32). Co-Authored-By: Claude Sonnet 5 --- conftest.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 conftest.py (limited to 'conftest.py') diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..38c2f13 --- /dev/null +++ b/conftest.py @@ -0,0 +1,15 @@ +"""Repo-wide pytest configuration.""" + +import asyncio +import sys + +# aiortc's ICE stack (aioice) never completes a loopback DataChannel handshake +# on Windows' default ProactorEventLoop — test_webrtc_transport.py hangs +# indefinitely, and with no per-test timeout it took the whole run down with it. +# A SelectorEventLoop is aiortc's documented requirement on Windows. The +# trade-off: SelectorEventLoop cannot spawn subprocesses on Windows, so the +# ffmpeg/ffprobe streaming tests fail here rather than pass and need a per-module +# Proactor override or skipif(win32). Set at import, before any loop is created; +# no effect off Windows, where the default policy already works for both. +if sys.platform == "win32": + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) -- cgit v1.2.3