Skip to content

gh-151096: Fix test_embed with split exec prefix#151288

Open
harjothkhara wants to merge 2 commits into
python:mainfrom
harjothkhara:gh-151096-test-embed-split-prefix
Open

gh-151096: Fix test_embed with split exec prefix#151288
harjothkhara wants to merge 2 commits into
python:mainfrom
harjothkhara:gh-151096-test-embed-split-prefix

Conversation

@harjothkhara

@harjothkhara harjothkhara commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

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.
  • Full ./python.exe -m test test_embed -v passes.

This is a tests-only change; skip news.

@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Jun 10, 2026
@harjothkhara

Copy link
Copy Markdown
Contributor Author

This is a tests-only change. Could a triager please add the skip news label?

@harjothkhara harjothkhara marked this pull request as ready for review June 10, 2026 23:09
@harjothkhara

Copy link
Copy Markdown
Contributor Author

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.

@harjothkhara

Copy link
Copy Markdown
Contributor Author

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.

@harjothkhara

Copy link
Copy Markdown
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant