gh-106718: Treat PyConfig.stdlib_dir as highest-priority setting for stdlib_dir when calculating paths (GH-108730)

This commit is contained in:
Yilei Yang 2023-11-01 14:11:18 -07:00 committed by GitHub
parent 821a7ac493
commit 834b7c18d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 10 deletions

View file

@ -818,6 +818,20 @@ class MockGetPathTests(unittest.TestCase):
actual = getpath(ns, expected)
self.assertEqual(expected, actual)
def test_explicitly_set_stdlib_dir(self):
"""Test the explicitly set stdlib_dir in the config is respected."""
ns = MockPosixNamespace(
PREFIX="/usr",
argv0="python",
ENV_PATH="/usr/bin",
)
ns["config"]["stdlib_dir"] = "/custom_stdlib_dir"
expected = dict(
stdlib_dir="/custom_stdlib_dir",
)
actual = getpath(ns, expected)
self.assertEqual(expected, actual)
# ******************************************************************************