diff options
author | Sandro Mani <manisandro@gmail.com> | 2020-06-08 15:28:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-08 15:28:11 (GMT) |
commit | 8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae (patch) | |
tree | 8aa9027476167eca69c0e17ba8712f624bdb8e15 /Lib | |
parent | c6b292cdeee689f0bfac6c1e2c2d4e4e01fa8d9e (diff) | |
download | cpython-8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae.zip cpython-8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae.tar.gz cpython-8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae.tar.bz2 |
bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var (GH-20605)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_embed.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 3d60b2f..f1371db 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -380,6 +380,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'exec_prefix': GET_DEFAULT_CONFIG, 'base_exec_prefix': GET_DEFAULT_CONFIG, 'module_search_paths': GET_DEFAULT_CONFIG, + 'platlibdir': sys.platlibdir, 'site_import': 1, 'bytes_warning': 0, @@ -585,13 +586,14 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): if value is self.GET_DEFAULT_CONFIG: expected[key] = config[key] - pythonpath_env = expected['pythonpath_env'] - if pythonpath_env is not None: - paths = pythonpath_env.split(os.path.pathsep) - expected['module_search_paths'] = [*paths, *expected['module_search_paths']] - if modify_path_cb is not None: - expected['module_search_paths'] = expected['module_search_paths'].copy() - modify_path_cb(expected['module_search_paths']) + if expected['module_search_paths'] is not self.IGNORE_CONFIG: + pythonpath_env = expected['pythonpath_env'] + if pythonpath_env is not None: + paths = pythonpath_env.split(os.path.pathsep) + expected['module_search_paths'] = [*paths, *expected['module_search_paths']] + if modify_path_cb is not None: + expected['module_search_paths'] = expected['module_search_paths'].copy() + modify_path_cb(expected['module_search_paths']) for key in self.COPY_PRE_CONFIG: if key not in expected_preconfig: @@ -764,6 +766,8 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'buffered_stdio': 0, 'user_site_directory': 0, 'faulthandler': 1, + 'platlibdir': 'my_platlibdir', + 'module_search_paths': self.IGNORE_CONFIG, 'check_hash_pycs_mode': 'always', 'pathconfig_warnings': 0, @@ -795,6 +799,8 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'user_site_directory': 0, 'faulthandler': 1, 'warnoptions': ['EnvVar'], + 'platlibdir': 'env_platlibdir', + 'module_search_paths': self.IGNORE_CONFIG, '_use_peg_parser': 0, } self.check_all_configs("test_init_compat_env", config, preconfig, @@ -823,6 +829,8 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'user_site_directory': 0, 'faulthandler': 1, 'warnoptions': ['EnvVar'], + 'platlibdir': 'env_platlibdir', + 'module_search_paths': self.IGNORE_CONFIG, '_use_peg_parser': 0, } self.check_all_configs("test_init_python_env", config, preconfig, |