summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-03-29 15:13:46 +0100
committerGitHub <noreply@github.com>2019-03-29 15:13:46 +0100
commit2f54908afc5665937d763510b4430f10cf764641 (patch)
tree8ceaf77d86f93ec2908129e03a4ad872d6e20c22 /Lib/test
parent5f45979b63300338b68709bfe817ddae563b93fd (diff)
downloadcpython-git-2f54908afc5665937d763510b4430f10cf764641.tar.gz
bpo-36471: Add _Py_RunMain() (GH-12618)
* Add config_read_cmdline() subfunction. Remove _PyCmdline structure. * _PyCoreConfig_Read() now also parses config->argv command line arguments
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_embed.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index 164527a664..cd6027205a 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -53,7 +53,12 @@ class EmbeddingTestsMixin:
stderr=subprocess.PIPE,
universal_newlines=True,
env=env)
- (out, err) = p.communicate()
+ try:
+ (out, err) = p.communicate()
+ except:
+ p.terminate()
+ p.wait()
+ raise
if p.returncode != 0 and support.verbose:
print(f"--- {cmd} failed ---")
print(f"stdout:\n{out}")
@@ -254,6 +259,11 @@ class EmbeddingTests(EmbeddingTestsMixin, unittest.TestCase):
self.assertEqual(out.rstrip(), "Py_Main() after Py_Initialize: sys.argv=['-c', 'arg2']")
self.assertEqual(err, '')
+ def test_run_main(self):
+ out, err = self.run_embedded_interpreter("run_main")
+ self.assertEqual(out.rstrip(), "_Py_RunMain(): sys.argv=['-c', 'arg2']")
+ self.assertEqual(err, '')
+
class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
maxDiff = 4096
@@ -549,10 +559,11 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
'pycache_prefix': 'conf_pycache_prefix',
'program_name': './conf_program_name',
- 'argv': ['-c', 'pass'],
+ 'argv': ['-c', 'arg2'],
'program': 'conf_program',
'xoptions': ['core_xoption1=3', 'core_xoption2=', 'core_xoption3'],
'warnoptions': ['error::ResourceWarning', 'default::BytesWarning'],
+ 'run_command': 'pass\n',
'site_import': 0,
'bytes_warning': 1,