gh-152548: Convert test_eintr to the test.support.isolated() decorator#152570
Open
serhiy-storchaka wants to merge 4 commits into
Open
gh-152548: Convert test_eintr to the test.support.isolated() decorator#152570serhiy-storchaka wants to merge 4 commits into
serhiy-storchaka wants to merge 4 commits into
Conversation
Run a test in a fresh interpreter subprocess, so that it does not share global or interpreter state with the rest of the test run. It can decorate a test method (only that method runs in a subprocess) or a TestCase subclass (the whole class runs in one subprocess, with its setUpClass()/setUp()/tearDown()/ tearDownClass() running once there). Failures, errors and skips, including those of individual subtests, are reported for the test and show the original subprocess traceback. The subprocess inherits the parent's resource, memory and verbosity configuration, so that requires_resource(), bigmemtest() and similar behave the same in both processes. The test.support.running_isolated flag is true in the subprocess, so that fixtures can choose what to run there. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fixes the ruff F401 "imported but unused" lint failure for the re-exports. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…corator The EINTR tests need a process with no background thread so signals reach the main thread; they were driven as a script via run_test_script. With @support.isolated() each test class runs in its own fresh subprocess and the tests are reported individually instead of as one opaque test_all. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Author
|
@vstinner, please look at this. It produces much better report. |
Documentation build overview
5 files changed ·
|
@isolated() always runs the test in a subprocess, so skip it in the parent process on platforms that lack subprocess support, the same way the tests it replaces were guarded by requires_subprocess(). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
The EINTR tests need a process with no background thread so that signals are delivered to the main thread. They were driven as a script in a child process (
_test_eintr.pyrun viascript_helper.run_test_script()), reported to the runner as a single opaquetest_all.With
@support.isolated()each test class runs in its own fresh subprocess, so the individual EINTR tests are collected and reported (with real tracebacks) directly undertest_eintr. The test code itself is unchanged;_test_eintr.pyis renamed totest_eintr.py(the per-class@isolated()/@requires_resource('walltime')decorators are the only additions), and the thin wrapper is removed.This is built on top of #152551 (the
test.support.isolated()decorator). The first two commits belong to that PR and will drop out once it is merged and this branch is rebased.