Repository navigation
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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.
Summary
With
--timeout-method=thread -p no:terminal, a test that exceeds its timeout can still finish and return exit code 0.config.get_terminal_writer()raises in the timer thread before thetry/finallycontainingos._exit(1), so the timeout never terminates the process.Keep the existing terminal reporter when available and otherwise use a
TerminalWriteron stderr. Create it after disabling capture so it writes to the restored stream. Move writer acquisition inside the protected block and guard its final flush. Add a changelog entry and regression tests.Evidence
A test containing
time.sleep(2)with--timeout=1 --timeout-method=thread -p no:terminalexits 0 before the fix and 1 afterward.fd,sys,tee-sys, no capture, and the disabled capture plugin, asserting exit status, preserved output, stack diagnostics, and that execution does not reach the end of the test. Each nested run has a 20-second outer timeout.pre-commit run --all-files --show-diff-on-failurepassed, including Ruff, YAML and typo checks.capsysandcapfdwith global capture disabled; both preserve buffered output and terminate with a stack dump.Merge considerations
The change is limited to thread-timeout reporting; the signal method and debugger detection keep their current behavior. Linux, Windows and the remaining Python versions were not run locally and remain for CI. This change is reversible without migration.
Prepared with AI assistance and independently reviewed by another agent; that review is not maintainer approval.