aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_getpath.py
diff options
context:
space:
mode:
authorYilei Yang <yileiyang@google.com>2023-11-01 14:11:18 -0700
committerGitHub <noreply@github.com>2023-11-01 21:11:18 +0000
commit834b7c18d74da3b30fdca66cc7da6b9e1db3ce6c (patch)
treefafb01f95bf7efa83da0ff21e90e99a680752038 /Lib/test/test_getpath.py
parent821a7ac493120b6d5065598cfa835ab3f25965cb (diff)
downloadcpython-834b7c18d74da3b30fdca66cc7da6b9e1db3ce6c.tar.gz
cpython-834b7c18d74da3b30fdca66cc7da6b9e1db3ce6c.zip
gh-106718: Treat PyConfig.stdlib_dir as highest-priority setting for stdlib_dir when calculating paths (GH-108730)
Diffstat (limited to 'Lib/test/test_getpath.py')
-rw-r--r--Lib/test/test_getpath.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_getpath.py b/Lib/test/test_getpath.py
index b9cbe1d92c4..2f7aa69efc1 100644
--- a/Lib/test/test_getpath.py
+++ b/Lib/test/test_getpath.py
@@ -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)
+
# ******************************************************************************