mirror of
https://github.com/python/cpython.git
synced 2025-07-16 07:45:20 +00:00
bpo-44131: Test Py_FrozenMain() (GH-26126)
* Add test_frozenmain to test_embed * Add Programs/test_frozenmain.py * Add Programs/freeze_test_frozenmain.py * Add Programs/test_frozenmain.h * Add make regen-test-frozenmain * Add test_frozenmain command to Programs/_testembed * _testembed.c: add error(msg) function
This commit is contained in:
parent
f32c7950e0
commit
eaede0ded7
10 changed files with 203 additions and 32 deletions
|
@ -1480,6 +1480,21 @@ class MiscTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||
# when Python is initialized multiples times.
|
||||
self.run_embedded_interpreter("test_unicode_id_init")
|
||||
|
||||
# See bpo-44133
|
||||
@unittest.skipIf(os.name == 'nt',
|
||||
'Py_FrozenMain is not exported on Windows')
|
||||
def test_frozenmain(self):
|
||||
out, err = self.run_embedded_interpreter("test_frozenmain")
|
||||
exe = os.path.realpath('./argv0')
|
||||
expected = textwrap.dedent(f"""
|
||||
Frozen Hello World
|
||||
sys.argv ['./argv0', '-E', 'arg1', 'arg2']
|
||||
config program_name: ./argv0
|
||||
config executable: {exe}
|
||||
config use_environment: 1
|
||||
""").lstrip()
|
||||
self.assertEqual(out, expected)
|
||||
|
||||
|
||||
class StdPrinterTests(EmbeddingTestsMixin, unittest.TestCase):
|
||||
# Test PyStdPrinter_Type which is used by _PySys_SetPreliminaryStderr():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue