diff options
author | Victor Stinner <vstinner@python.org> | 2020-11-05 17:12:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-05 17:12:33 (GMT) |
commit | f3cb81431574453aac3b6dcadb3120331e6a8f1c (patch) | |
tree | 05f4c4cf4ae0625a76a118856e9fa7dbcd520adf /Lib/test/test_embed.py | |
parent | 4662fa9bfe4a849fe87bfb321d8ef0956c89a772 (diff) | |
download | cpython-f3cb81431574453aac3b6dcadb3120331e6a8f1c.zip cpython-f3cb81431574453aac3b6dcadb3120331e6a8f1c.tar.gz cpython-f3cb81431574453aac3b6dcadb3120331e6a8f1c.tar.bz2 |
bpo-42260: Add _PyConfig_FromDict() (GH-23167)
* Rename config_as_dict() to _PyConfig_AsDict().
* Add 'module_search_paths_set' to _PyConfig_AsDict().
* Add _PyConfig_FromDict().
* Add get_config() and set_config() to _testinternalcapi.
* Add config_check_consistency().
Diffstat (limited to 'Lib/test/test_embed.py')
-rw-r--r-- | Lib/test/test_embed.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 36a0e77..9182061 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -30,6 +30,8 @@ API_PYTHON = 2 # _PyCoreConfig_InitIsolatedConfig() API_ISOLATED = 3 +MAX_HASH_SEED = 4294967295 + def debug_build(program): program = os.path.basename(program) @@ -382,6 +384,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'exec_prefix': GET_DEFAULT_CONFIG, 'base_exec_prefix': GET_DEFAULT_CONFIG, 'module_search_paths': GET_DEFAULT_CONFIG, + 'module_search_paths_set': 1, 'platlibdir': sys.platlibdir, 'site_import': 1, @@ -1408,6 +1411,17 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): # ignore output +class SetConfigTests(unittest.TestCase): + def test_set_config(self): + # bpo-42260: Test _PyInterpreterState_SetConfig() + cmd = [sys.executable, '-I', '-m', 'test._test_embed_set_config'] + proc = subprocess.run(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + self.assertEqual(proc.returncode, 0, + (proc.returncode, proc.stdout, proc.stderr)) + + class AuditingTests(EmbeddingTestsMixin, unittest.TestCase): def test_open_code_hook(self): self.run_embedded_interpreter("test_open_code_hook") |