diff options
author | Filipe Laíns 🇵🇸 <lains@riseup.net> | 2024-12-08 05:57:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-08 05:57:22 (GMT) |
commit | 70154855cf698560dd9a5e484a649839cd68dc7c (patch) | |
tree | 1b6ec9a01bd0bd679ba5370ef62d745f3f5fd03a /Lib/test | |
parent | 79b7cab50a3292a1c01466cf0e69fb7b4e56cfb1 (diff) | |
download | cpython-70154855cf698560dd9a5e484a649839cd68dc7c.zip cpython-70154855cf698560dd9a5e484a649839cd68dc7c.tar.gz cpython-70154855cf698560dd9a5e484a649839cd68dc7c.tar.bz2 |
GH-126789: fix some sysconfig data on late site initializations (#127729)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_sysconfig.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 0df1a67..ce504dc 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -53,6 +53,8 @@ class TestSysConfig(unittest.TestCase): os.uname = self._get_uname # saving the environment self.name = os.name + self.prefix = sys.prefix + self.exec_prefix = sys.exec_prefix self.platform = sys.platform self.version = sys.version self._framework = sys._framework @@ -77,6 +79,8 @@ class TestSysConfig(unittest.TestCase): else: del os.uname os.name = self.name + sys.prefix = self.prefix + sys.exec_prefix = self.exec_prefix sys.platform = self.platform sys.version = self.version sys._framework = self._framework @@ -653,6 +657,27 @@ class TestSysConfig(unittest.TestCase): self.assertEqual(system_config_vars, json_config_vars) + def test_sysconfig_config_vars_no_prefix_cache(self): + sys.prefix = 'prefix-AAA' + sys.exec_prefix = 'exec-prefix-AAA' + + config_vars = sysconfig.get_config_vars() + + self.assertEqual(config_vars['prefix'], sys.prefix) + self.assertEqual(config_vars['base'], sys.prefix) + self.assertEqual(config_vars['exec_prefix'], sys.exec_prefix) + self.assertEqual(config_vars['platbase'], sys.exec_prefix) + + sys.prefix = 'prefix-BBB' + sys.exec_prefix = 'exec-prefix-BBB' + + config_vars = sysconfig.get_config_vars() + + self.assertEqual(config_vars['prefix'], sys.prefix) + self.assertEqual(config_vars['base'], sys.prefix) + self.assertEqual(config_vars['exec_prefix'], sys.exec_prefix) + self.assertEqual(config_vars['platbase'], sys.exec_prefix) + class MakefileTests(unittest.TestCase): |