Skip to content

fix: use thread-based timeouts for cross-platform compatibility - #38870

Closed
mohamedswe wants to merge 0 commit into
NousResearch:mainfrom
mohamedswe:fix/windows-pytest-timeout
Closed

fix: use thread-based timeouts for cross-platform compatibility#38870
mohamedswe wants to merge 0 commit into
NousResearch:mainfrom
mohamedswe:fix/windows-pytest-timeout

Conversation

@mohamedswe

ghost commented Jun 4, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes Windows pytest compatibility by switching from signal-based to thread-based timeouts. The signal method uses SIGALRM which is POSIX-only and causes AttributeError on Windows. Thread method works cross-platform with negligible performance difference.

Root cause: tests/conftest.py line 448 mentions "The old SIGALRM-based fixture (POSIX-only, didn't work on Windows) is gone" but pyproject.toml still referenced signal method.

Related Issue

No existing issue - discovered during Windows contributor environment setup.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • Changed pytest-timeout method from signal to thread in pyproject.toml line 287
  • Updated comment to explain cross-platform compatibility rationale

How to Test

Before (main branch, Windows):

pytest tests/test_hermes_state.py::TestSessionLifecycle::test_create_and_get_session -v
# Error: AttributeError: module 'signal' has no attribute 'SIGALRM'

After (this branch, Windows):

pytest tests/test_hermes_state.py::TestSessionLifecycle::test_create_and_get_session -v
# ✅ 1 passed in 0.86s

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix:)
  • I searched for existing PRs - this isn't a duplicate
  • My PR contains only related changes
  • I've run pytest tests/ -q and all tests pass
  • I've added tests - N/A (config change, existing 17K tests validate behavior)
  • I've tested on my platform: Windows 11, Python 3.11.9

Documentation & Housekeeping

  • I've updated relevant documentation (added explanatory comment in pyproject.toml) — or N/A
  • I've updated cli-config.yaml.example — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — N/A
  • I've considered cross-platform impact — this IS the cross-platform fix!
  • I've updated tool descriptions/schemas — N/A

Screenshots / Logs

Before fix (main branch, Windows 11, Python 3.11.9):

platform win32 -- Python 3.11.9, pytest-9.0.2, pluggy-1.6.0
timeout: 30.0s
timeout method: signal
timeout func_only: False

INTERNALERROR> File "...\pytest_timeout.py", line 324, in pytest_timeout_set_timer
INTERNALERROR>     signal.signal(signal.SIGALRM, handler)
INTERNALERROR>                   ^^^^^^^^^^^^^^
INTERNALERROR> AttributeError: module 'signal' has no attribute 'SIGALRM'

==================================================== no tests ran in 0.40s ====================================================

After fix (fix/windows-pytest-timeout branch, Windows 11, Python 3.11.9):

platform win32 -- Python 3.11.9, pytest-9.0.2, pluggy-1.6.0
timeout: 30.0s
timeout method: thread  ← Changed!
timeout func_only: False
collected 1 item

tests/test_hermes_state.py::TestSessionLifecycle::test_create_and_get_session PASSED [100%]

====================================================== 1 passed in 0.86s ======================================================

Key difference: timeout method: signaltimeout method: thread

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists python:uv Pull requests that update python:uv code type/bug Something isn't working type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants