test(windows): run pytest-timeout in thread mode on Windows

The pyproject addopts pin `--timeout-method=signal` relies on signal.SIGALRM,
which doesn't exist on Windows. pytest-timeout raised AttributeError at timer
setup and aborted the entire run before any test executed, so the suite was
unrunnable on Windows by default. Override timeout_method to "thread" on
Windows in pytest_configure; POSIX keeps the more reliable signal method.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Charles Power 2026-06-07 21:44:46 -07:00 committed by Teknium
parent fd92a3a5c9
commit b12c0cd997

View file

@ -534,6 +534,14 @@ def pytest_configure(config): # noqa: D401 — pytest hook
"behaviour — e.g. PTY tests that signal their own child).",
)
# The pyproject addopts pin ``--timeout-method=signal`` relies on
# ``signal.SIGALRM``, which does not exist on Windows — pytest-timeout
# raises AttributeError at timer setup and the whole run aborts before any
# test executes. Fall back to the thread-based timer on Windows so the
# suite runs natively there (POSIX keeps the more reliable signal method).
if sys.platform == "win32" and getattr(config.option, "timeout_method", None) == "signal":
config.option.timeout_method = "thread"
@pytest.fixture(autouse=True)
def _live_system_guard(request, monkeypatch):