You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix test_init_is_python_build_with_home for builds configured with different --prefix and --exec-prefix.
When running from the build directory on POSIX, getpath uses PREFIX for prefix/base_prefix and EXEC_PREFIX for exec_prefix/base_exec_prefix. The test expected both values to match sys.prefix, which fails for split-prefix builds.
This also updates module_search_paths() so its default exec_prefix comes from the expected config’s exec_prefix instead of prefix.
Validation:
Configured a local split-prefix build with --prefix=/private/tmp/cpython-151096-install --exec-prefix=/private/tmp/cpython-151096-install/exec.
Before the fix, ./python.exe -m test test_embed -v -m test_init_is_python_build_with_home failed with mismatched exec_prefix / base_exec_prefix.
After the fix, ./python.exe -m test test_embed -v -m test_init_is_python_build_with_home passes.
This PR only touches Lib/test/test_embed.py — it adds a regression test for test_embed when the build uses a split exec prefix (gh-151096). There's no user-facing or behavioral change, so there's nothing to record in Misc/NEWS.d.
Could a core dev apply the skip news label so the bedevere/news check goes green? Happy to add a blurb instead if that's preferred.
Added a Tests NEWS entry (Misc/NEWS.d/next/Tests/…gh-issue-151096…) so bedevere/news is satisfied — no skip news needed. This is purely the test fix for gh-151096; no behavioral change. Ready for review.
@vstinner — small test-only fix in your test_embed area: test_init_is_python_build_with_home (and the module_search_paths helper) assumed exec_prefix == prefix, so test_embed fails when configured with --exec-prefix differing from --prefix (gh-151096); the fix reads sys.exec_prefix / config['exec_prefix'] separately. CI is green and there's a Tests NEWS entry — would you be able to review/merge when you have a moment? Happy to adjust.
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
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
test_init_is_python_build_with_homefor builds configured with different--prefixand--exec-prefix.When running from the build directory on POSIX, getpath uses
PREFIXforprefix/base_prefixandEXEC_PREFIXforexec_prefix/base_exec_prefix. The test expected both values to matchsys.prefix, which fails for split-prefix builds.This also updates
module_search_paths()so its defaultexec_prefixcomes from the expected config’sexec_prefixinstead ofprefix.Validation:
--prefix=/private/tmp/cpython-151096-install --exec-prefix=/private/tmp/cpython-151096-install/exec../python.exe -m test test_embed -v -m test_init_is_python_build_with_homefailed with mismatchedexec_prefix/base_exec_prefix../python.exe -m test test_embed -v -m test_init_is_python_build_with_homepasses../python.exe -m test test_embed -vpasses.This is a tests-only change; skip news.