Skip to content

Commit 834ae1a

Browse files
committed
update
1 parent 6b4857e commit 834ae1a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

code/tests/test_code_in_scripts.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ def run_py(path):
2121
f.write('\n'.join(content))
2222

2323
args = ["python", py_path]
24-
p = subprocess.check_output(args,
25-
stdout=subprocess.PIPE,
26-
stderr=subprocess.PIPE)
27-
print(p.stdout)
28-
print(p.stderr)
24+
try:
25+
output = subprocess.check_output(
26+
args, stderr=subprocess.STDOUT, shell=True, timeout=1000,
27+
universal_newlines=True)
28+
except subprocess.CalledProcessError as exc:
29+
print("Status: FAIL", exc.returncode, exc.output)
30+
else:
31+
print("Output: \n%s\n" % output)
2932

3033
os.chdir(orig_dir)
3134

0 commit comments

Comments
 (0)