Repository navigation
gh-128779: Fix system site-packages test inside a virtual environment - #160133
Merged
ambv merged 1 commit intoOct 21, 2026
Merged
Conversation
…onment Use the base interpreter prefixes when expanding the system install scheme so nested virtual environments are compared with the base interpreter site-packages rather than the outer virtual environment. Co-authored-by: Muse Code (Meta Muse Spark)
This was referenced Oct 21, 2026
FFY00
reviewed
Oct 22, 2026
| )) | ||
| """) | ||
|
|
||
| # Use _get_preferred_schemes to find the system scheme, in case we are in a virtual environment |
Member
There was a problem hiding this comment.
Why revert _get_preferred_schemes instead of just specifying prefix/exec_prefix?
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 the
test_site.ImportSideEffectTests.test_system_site_packagesregression introduced by #129462, which is failing the Hypothesis tests on Ubuntu job on unrelated PRs, including #101318.The job runs the test suite inside
hypovenv. Selecting the system install scheme with_get_preferred_schemes()does not reset its expansion variables:baseandplatbasestill describe that outer virtual environment. The test therefore expects the outer environment's site-packages in a nested virtual environment created withsystem_site_packages=True, although that environment uses the base interpreter's system site-packages.Expand the existing system scheme with
sys.base_prefixandsys.base_exec_prefix. The existing assertions and the check for absent system site-packages directories remain in place.Failure log: https://github.com/python/cpython/actions/runs/39679725959/job/119499178669
Verification
On macOS ARM64:
buildpycompleted successfully.testpy test_sitepassed: 98 tests run, 5 skipped.PYTHONBINARY=<venv>/bin/python testpy test_sitepassed: 98 tests run, 8 skipped.git diff --checkpassed.This changes only a test, so no NEWS entry is needed. AI assistance was used to investigate and prepare the change.
--system-site-packagesdoesn't work (system packages are not detected) #128779