CI: add pytest-timeout so a wedged test fails fast (#368)#369
Open
matthewholman wants to merge 2 commits into
Open
CI: add pytest-timeout so a wedged test fails fast (#368)#369matthewholman wants to merge 2 commits into
matthewholman wants to merge 2 commits into
Conversation
A random matrix leg's pytest step has repeatedly hung for hours on a network/ ephemeris fetch with no timeout, requiring a manual cancel + re-run (seen on ubuntu-3.14 and ubuntu-3.13 across recent PRs). Add pytest-timeout (dev dep) and a 300s per-test cap in [tool.pytest.ini_options] (timeout_method='thread', which works with pytest-xdist and on all platforms). A wedged test now fails fast with a traceback pointing at the hang instead of stalling the whole job. Verified: pytest reads the config (header shows 'timeout: 300.0s / method: thread') and enforcement fires (a 5s sleep fails at ~1s under --timeout=1). Closes #368. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The first revision set timeout_method='thread', which on timeout calls os._exit() and so kills the whole pytest-xdist worker -- CI surfaced this as ten 'worker gwN crashed' errors during a transient ephemeris/NAIF outage (every affected test was an ephem-fetch one). The 'signal' method (SIGALRM) instead raises a clean per-test 'Failed: Timeout' and lets the worker continue. Verified clean under -n 2. CI runs only on Linux/macOS, where SIGALRM is available. Refs #368.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #368.
Adds
pytest-timeout(dev dep) and a 300s per-test cap in[tool.pytest.ini_options](timeout_method="thread", compatible with pytest-xdist and all platforms), so a test that wedges on a network/ephemeris fetch fails fast with a traceback instead of hanging the CI job for hours (observed on ubuntu-3.14 and ubuntu-3.13 across recent PRs).Verified locally: pytest reads the config (
timeout: 300.0s / method: thread) and enforcement fires (a 5s sleep fails at ~1s under--timeout=1).