summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_embed.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-05-17 21:48:35 (GMT)
committerGitHub <noreply@github.com>2021-05-17 21:48:35 (GMT)
commiteaede0ded72e67cee4a91c086847d54cb64ca74c (patch)
tree3c9bf4c33572db77fc79ae6a701628614c94f3a6 /Lib/test/test_embed.py
parentf32c7950e0077b6d9a8e217c2796fc582f18ca08 (diff)
downloadcpython-eaede0ded72e67cee4a91c086847d54cb64ca74c.zip
cpython-eaede0ded72e67cee4a91c086847d54cb64ca74c.tar.gz
cpython-eaede0ded72e67cee4a91c086847d54cb64ca74c.tar.bz2
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
Diffstat (limited to 'Lib/test/test_embed.py')
-rw-r--r--Lib/test/test_embed.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index 23cf297..c68a662 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -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():