11import json
2- import shlex
32import subprocess
43import sys
54import tempfile
@@ -44,7 +43,7 @@ def tmp_dir_cleanup():
4443
4544def test_help ():
4645 c = f"{ executable } -h"
47- proc = subprocess .Popen (shlex . split ( c ) , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
46+ proc = subprocess .Popen (c , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
4847 stdout , stderr = proc .communicate ()
4948 assert not stderr , stderr
5049 assert stdout , stdout
@@ -92,8 +91,7 @@ def test_script(command):
9291@pytest .mark .parametrize ("command" , test_commands )
9392def test_script_attrs (command ):
9493 command += " -f attrs"
95- print ("Command:" , command )
96- proc = subprocess .Popen (shlex .split (command ), shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
94+ proc = subprocess .Popen (command , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
9795 stdout , stderr = map (bytes .decode , proc .communicate ())
9896 assert not stderr , stderr
9997 assert stdout , stdout
@@ -106,8 +104,7 @@ def test_script_attrs(command):
106104def test_script_custom (command ):
107105 command += " -f custom --code-generator json_to_models.models.attr.AttrsModelCodeGenerator"
108106 command += ' --code-generator-kwargs "meta=true"'
109- print ("Command:" , command )
110- proc = subprocess .Popen (shlex .split (command ), shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
107+ proc = subprocess .Popen (command , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
111108 stdout , stderr = map (bytes .decode , proc .communicate ())
112109 assert not stderr , stderr
113110 assert stdout , stdout
@@ -134,6 +131,6 @@ def test_script_custom(command):
134131@pytest .mark .parametrize ("command" , wrong_arguments_commands )
135132def test_wrong_arguments (command ):
136133 print ("Command:" , command )
137- proc = subprocess .Popen (shlex . split ( command ) , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
134+ proc = subprocess .Popen (command , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
138135 stdout , stderr = map (bytes .decode , proc .communicate ())
139136 assert not stderr and proc .returncode == 0 , stderr
0 commit comments