gh-122941: Fix test_launcher sporadic failures via py.ini isolation#145090
Merged
zooba merged 2 commits intopython:mainfrom Mar 4, 2026
Merged
gh-122941: Fix test_launcher sporadic failures via py.ini isolation#145090zooba merged 2 commits intopython:mainfrom
zooba merged 2 commits intopython:mainfrom
Conversation
The launcher reads py.ini from %LOCALAPPDATA% via SHGetFolderPathW, which is shared across all processes for a given user. When multiple test processes run concurrently on the same machine, one process's py.ini writes (e.g. python3=PythonTestSuite/3.100-arm64) leak into another process's launcher invocations, causing assertions like "PythonCore != PythonTestSuite" to fail. Add a PYLAUNCHER_INIDIR environment variable to the launcher that, when set, redirects py.ini lookup to the specified directory and skips the default locations. Update test_launcher.py to create an isolated temp directory per test class and pass it via PYLAUNCHER_INIDIR.
Contributor
Author
|
!buildbot AMD64 Windows Server 2022 NoGIL |
|
🤖 New build scheduled with the buildbot fleet by @itamaro for commit a8427d8 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F145090%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
chris-eibl
approved these changes
Feb 21, 2026
Contributor
|
LGTM! |
Contributor
Author
|
@zooba any concerns with this change? |
zooba
reviewed
Mar 2, 2026
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Mar 5, 2026
…tion (pythonGH-145090) Adds _PYLAUNCHER_INIDIR as a private variable since the launcher is deprecated and not getting new features. (cherry picked from commit 6cdbd7b) Co-authored-by: Itamar Oren <itamarost@gmail.com>
|
GH-145572 is a backport of this pull request to the 3.13 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Mar 5, 2026
…tion (pythonGH-145090) Adds _PYLAUNCHER_INIDIR as a private variable since the launcher is deprecated and not getting new features. (cherry picked from commit 6cdbd7b) Co-authored-by: Itamar Oren <itamarost@gmail.com>
|
GH-145573 is a backport of this pull request to the 3.14 branch. |
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.
Note: this PR was authored with assistance from Claude Code Opus 4.6
The launcher reads py.ini from
%LOCALAPPDATA%viaSHGetFolderPathW, which is shared across all processes for a given user. When multiple test processes run concurrently on the same machine, one process'spy.iniwrites leak into another process's launcher invocations, causing assertions like"PythonCore != PythonTestSuite"to fail.Add a
PYLAUNCHER_INIDIRenvironment variable to the launcher that, when set, redirectspy.inilookup to the specified directory and skips the default locations. Updatetest_launcher.pyto create an isolated temp directory per test class and pass it viaPYLAUNCHER_INIDIR.I verified this fix on my Windows buildbot worker that's currently failing due to this issue.
with this PR, all tests pass:
without it, 2 tests fail: