Skip to content

Commit 23a8608

Browse files
committed
Update tests
1 parent b93e38e commit 23a8608

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

test/test_cli/test_script.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
import shlex
32
import subprocess
43
import sys
54
import tempfile
@@ -44,7 +43,7 @@ def tmp_dir_cleanup():
4443

4544
def 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)
9392
def 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):
106104
def 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)
135132
def 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

Comments
 (0)