@@ -366,6 +366,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
366366 'program_name' : GET_DEFAULT_CONFIG ,
367367 'parse_argv' : 0 ,
368368 'argv' : ["" ],
369+ '_orig_argv' : [],
369370
370371 'xoptions' : [],
371372 'warnoptions' : [],
@@ -739,7 +740,12 @@ def test_init_from_config(self):
739740
740741 'pycache_prefix' : 'conf_pycache_prefix' ,
741742 'program_name' : './conf_program_name' ,
742- 'argv' : ['-c' , 'arg2' , ],
743+ 'argv' : ['-c' , 'arg2' ],
744+ '_orig_argv' : ['python3' ,
745+ '-W' , 'cmdline_warnoption' ,
746+ '-X' , 'cmdline_xoption' ,
747+ '-c' , 'pass' ,
748+ 'arg2' ],
743749 'parse_argv' : 1 ,
744750 'xoptions' : [
745751 'config_xoption1=3' ,
@@ -872,6 +878,7 @@ def test_preinit_parse_argv(self):
872878 }
873879 config = {
874880 'argv' : ['script.py' ],
881+ '_orig_argv' : ['python3' , '-X' , 'dev' , 'script.py' ],
875882 'run_filename' : os .path .abspath ('script.py' ),
876883 'dev_mode' : 1 ,
877884 'faulthandler' : 1 ,
@@ -886,9 +893,14 @@ def test_preinit_dont_parse_argv(self):
886893 preconfig = {
887894 'isolated' : 0 ,
888895 }
896+ argv = ["python3" ,
897+ "-E" , "-I" ,
898+ "-X" , "dev" ,
899+ "-X" , "utf8" ,
900+ "script.py" ]
889901 config = {
890- 'argv' : [ "python3" , "-E" , "-I" ,
891- "-X" , "dev" , "-X" , "utf8" , "script.py" ] ,
902+ 'argv' : argv ,
903+ '_orig_argv' : argv ,
892904 'isolated' : 0 ,
893905 }
894906 self .check_all_configs ("test_preinit_dont_parse_argv" , config , preconfig ,
@@ -967,6 +979,9 @@ def test_init_sys_add(self):
967979 'ignore:::sysadd_warnoption' ,
968980 'ignore:::config_warnoption' ,
969981 ],
982+ '_orig_argv' : ['python3' ,
983+ '-W' , 'ignore:::cmdline_warnoption' ,
984+ '-X' , 'cmdline_xoption' ],
970985 }
971986 self .check_all_configs ("test_init_sys_add" , config , api = API_PYTHON )
972987
@@ -975,6 +990,7 @@ def test_init_run_main(self):
975990 'print(json.dumps(_testinternalcapi.get_configs()))' )
976991 config = {
977992 'argv' : ['-c' , 'arg2' ],
993+ '_orig_argv' : ['python3' , '-c' , code , 'arg2' ],
978994 'program_name' : './python3' ,
979995 'run_command' : code + '\n ' ,
980996 'parse_argv' : 1 ,
@@ -986,6 +1002,9 @@ def test_init_main(self):
9861002 'print(json.dumps(_testinternalcapi.get_configs()))' )
9871003 config = {
9881004 'argv' : ['-c' , 'arg2' ],
1005+ '_orig_argv' : ['python3' ,
1006+ '-c' , code ,
1007+ 'arg2' ],
9891008 'program_name' : './python3' ,
9901009 'run_command' : code + '\n ' ,
9911010 'parse_argv' : 1 ,
@@ -999,6 +1018,7 @@ def test_init_parse_argv(self):
9991018 config = {
10001019 'parse_argv' : 1 ,
10011020 'argv' : ['-c' , 'arg1' , '-v' , 'arg3' ],
1021+ '_orig_argv' : ['./argv0' , '-E' , '-c' , 'pass' , 'arg1' , '-v' , 'arg3' ],
10021022 'program_name' : './argv0' ,
10031023 'run_command' : 'pass\n ' ,
10041024 'use_environment' : 0 ,
@@ -1012,6 +1032,7 @@ def test_init_dont_parse_argv(self):
10121032 config = {
10131033 'parse_argv' : 0 ,
10141034 'argv' : ['./argv0' , '-E' , '-c' , 'pass' , 'arg1' , '-v' , 'arg3' ],
1035+ '_orig_argv' : ['./argv0' , '-E' , '-c' , 'pass' , 'arg1' , '-v' , 'arg3' ],
10151036 'program_name' : './argv0' ,
10161037 }
10171038 self .check_all_configs ("test_init_dont_parse_argv" , config , pre_config ,
@@ -1299,10 +1320,17 @@ def test_init_warnoptions(self):
12991320 'faulthandler' : 1 ,
13001321 'bytes_warning' : 1 ,
13011322 'warnoptions' : warnoptions ,
1323+ '_orig_argv' : ['python3' ,
1324+ '-Wignore:::cmdline1' ,
1325+ '-Wignore:::cmdline2' ],
13021326 }
13031327 self .check_all_configs ("test_init_warnoptions" , config , preconfig ,
13041328 api = API_PYTHON )
13051329
1330+ def test_get_argc_argv (self ):
1331+ self .run_embedded_interpreter ("test_get_argc_argv" )
1332+ # ignore output
1333+
13061334
13071335class AuditingTests (EmbeddingTestsMixin , unittest .TestCase ):
13081336 def test_open_code_hook (self ):
0 commit comments