[3.14] gh-151626: Fix tests that fail when PYTHONPYCACHEPREFIX is set (GH-151952)#152744
Merged
Conversation
…is set (pythonGH-151952) Fix tests in test_compileall, test_import, test_importlib, test_py_compile, and test_inspect to neutralize PYTHONPYCACHEPREFIX (cherry picked from commit 564c58c) Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com>
This was referenced Jul 1, 2026
|
Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
GH-152748 is a backport of this pull request to the 3.13 branch. |
gpshead
added a commit
that referenced
this pull request
Jul 1, 2026
…GH-151952) (GH-152744) (#152748) [3.14] gh-151626: Fix tests that fail when PYTHONPYCACHEPREFIX is set (GH-151952) (GH-152744) Fix tests in test_compileall, test_import, test_importlib, test_py_compile, and test_inspect to neutralize PYTHONPYCACHEPREFIX (cherry picked from commit 564c58c) (cherry picked from commit 7087839) Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com> Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.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.
Fix tests in test_compileall, test_import, test_importlib, test_py_compile, and test_inspect to neutralize PYTHONPYCACHEPREFIX
(cherry picked from commit 564c58c)
Co-authored-by: Jiucheng(Oliver) git.jiucheng@gmail.com
Manual backport notes (3.14)
miss-islington could not cleanly backport this to 3.14 due to a conflict in
Lib/test/test_inspect/test_inspect.py. The 3.14 branch predates thepython -m inspect --detailsCLI test refactor that exists on main/3.15 (it still has the simplerTestMain.test_detailsrather thanTestModuleCLIwith thetest_details_option_with_*/test_get_cli_details_for_*suite).The fix was translated to 3.14's dialect:
_expected_cached()helper was added verbatim from the original PR, inTestMain.TestMain.test_details, replacing the environment-dependentmodule.__spec__.cachedcheck. The redundantself.assertIn(module.__cached__, output)line (same pyc path, and itself failing underPYTHONPYCACHEPREFIX) was dropped.The other four files and the NEWS entry cherry-picked cleanly (identical hunks to the original).
Verified:
test_inspect,test_compileall,test_import,test_importlib, andtest_py_compileall pass both normally and withPYTHONPYCACHEPREFIXset;make patchcheckis clean.