diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2021-10-25 15:26:41 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-25 15:26:41 -0600 |
commit | 6afb285ff0790471a6858e44f85d143f07fda70c (patch) | |
tree | 4e8505fe17c108c8a58aecea7111775b59a66b29 /Lib/test/test_embed.py | |
parent | 2b8677a3cd855eb3a579894c64588eab0e006269 (diff) | |
download | cpython-6afb285ff0790471a6858e44f85d143f07fda70c.tar.gz cpython-6afb285ff0790471a6858e44f85d143f07fda70c.zip |
bpo-45020: Add tests for the -X "frozen_modules" option. (gh-28997)
We hadn't explicitly added any tests for this, so here they are.
https://bugs.python.org/issue45020
Diffstat (limited to 'Lib/test/test_embed.py')
-rw-r--r-- | Lib/test/test_embed.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 4186f011e23..7858f68d971 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1466,6 +1466,30 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): self.run_embedded_interpreter("test_get_argc_argv") # ignore output + def test_init_use_frozen_modules(self): + tests = { + ('=on', 1), + ('=off', 0), + ('=', 1), + ('', 1), + } + for raw, expected in tests: + optval = f'frozen_modules{raw}' + config = { + 'parse_argv': 2, + 'argv': ['-c'], + 'orig_argv': ['./argv0', '-X', optval, '-c', 'pass'], + 'program_name': './argv0', + 'run_command': 'pass\n', + 'use_environment': 1, + 'xoptions': [optval], + 'use_frozen_modules': expected, + } + env = {'TESTFROZEN': raw[1:]} if raw else None + with self.subTest(repr(raw)): + self.check_all_configs("test_init_use_frozen_modules", config, + api=API_PYTHON, env=env) + class SetConfigTests(unittest.TestCase): def test_set_config(self): |