Skip to content

gh-152548: Convert the test_signal wakeup tests to @runInSubprocess() - #152639

Open
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:test-signal-isolated
Open

gh-152548: Convert the test_signal wakeup tests to @runInSubprocess()#152639
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:test-signal-isolated

Conversation

@serhiy-storchaka

@serhiy-storchakaserhiy-storchaka commented Jun 29, 2026

Copy link
Copy Markdown
Member

The wakeup tests in WakeupSignalTests and WakeupSocketSignalTests need a process with no background thread so that signals are delivered to the main thread. Each was driven as a hand-written script string run in a child process via assert_python_ok('-c', ...), signalling failures with bare raise and reported to the runner only through the child exit code.

With @isolation.runInSubprocess() the same code runs as a normal method body in a fresh subprocess, using self.assert* and reported per test, with the subprocess traceback shown as the cause of a failure. The check_wakeup() helper becomes an ordinary helper that runs a test(read) callback in-process and asserts the read-back; the _testcapi skips move to the parent process (so no subprocess is spawned when skipped).

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33364015 | 📁 Comparing cb4fa6a against main (edcc07d)

🔍 Preview build

2 files changed
±library/test.html
±whatsnew/changelog.html

…cess()
WakeupSignalTests and WakeupSocketSignalTests ran each test as a script
string via assert_python_ok('-c', ...), using a subprocess to have a
single thread for signal delivery. Decorate them with @runInSubprocess()
instead, so the same code runs as a normal method body using self.assert*.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@serhiy-storchakaserhiy-storchaka changed the title gh-152548: Convert the test_signal wakeup tests to @isolated()gh-152548: Convert the test_signal wakeup tests to @runInSubprocess()Jul 27, 2026
@serhiy-storchakaserhiy-storchaka added tests Tests in the Lib/test dir skip news labels Jul 28, 2026
…ocess
Move the "OS doesn't report write() error on the read end of a pipe" check
out of test_wakeup_write_error into a decorator placed above
@runInSubprocess(), so that the test is skipped in the parent process instead
of spawning a subprocess first.
Replace the six identical no-op signal handlers of the wakeup tests with a
global noop_handler().
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core reviewskip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@serhiy-storchaka