summaryrefslogtreecommitdiff
path: root/tools/integration_tests.py
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-12-10 17:50:41 -0500
committerGitHub <noreply@github.com>2018-12-10 17:50:41 -0500
commit9a960b9f5804f5e855163e7ec43327c28daef845 (patch)
treef67a70c4c35999ff89601968e57783644063a062 /tools/integration_tests.py
parent1548792fb3530efb63432c0c704a3f0053410eb3 (diff)
Use stderr for exceptions (#1303)
Diffstat (limited to 'tools/integration_tests.py')
-rwxr-xr-xtools/integration_tests.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/integration_tests.py b/tools/integration_tests.py
index 95c670f61..67c6852d4 100755
--- a/tools/integration_tests.py
+++ b/tools/integration_tests.py
@@ -28,6 +28,15 @@ def read_test(file_name):
return test_dict
+def str2bool(v):
+ if v == "true":
+ return True
+ elif v == "false":
+ return False
+ else:
+ raise ValueError("Bad boolean value")
+
+
def integration_tests(deno_executable):
assert os.path.isfile(deno_executable)
tests = sorted([
@@ -40,6 +49,10 @@ def integration_tests(deno_executable):
test = read_test(test_abs)
exit_code = int(test.get("exit_code", 0))
args = test.get("args", "").split(" ")
+
+ check_stderr = str2bool(test.get("check_stderr", "false"))
+ stderr = subprocess.STDOUT if check_stderr else None
+
output_abs = os.path.join(root_path, test.get("output", ""))
with open(output_abs, 'r') as f:
expected_out = f.read()
@@ -48,7 +61,8 @@ def integration_tests(deno_executable):
print " ".join(cmd)
actual_code = 0
try:
- actual_out = subprocess.check_output(cmd, universal_newlines=True)
+ actual_out = subprocess.check_output(
+ cmd, universal_newlines=True, stderr=stderr)
except subprocess.CalledProcessError as e:
actual_code = e.returncode
actual_out = e.output