Skip to content

gh-152548: Convert test_eintr to the test.support.isolated() decorator#152570

Open
serhiy-storchaka wants to merge 4 commits into
python:mainfrom
serhiy-storchaka:test-eintr-isolated
Open

gh-152548: Convert test_eintr to the test.support.isolated() decorator#152570
serhiy-storchaka wants to merge 4 commits into
python:mainfrom
serhiy-storchaka:test-eintr-isolated

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

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.py run via script_helper.run_test_script()), reported to the runner as a single opaque test_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 under test_eintr. The test code itself is unchanged; _test_eintr.py is renamed to test_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.

serhiy-storchaka and others added 3 commits June 29, 2026 10:26
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>
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

@vstinner, please look at this. It produces much better report.

@read-the-docs-community

read-the-docs-community Bot commented Jun 29, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33352370 | 📁 Comparing 4d0f9ab against main (cdec9ac)

  🔍 Preview build  

5 files changed · ± 5 modified

± Modified

@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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant