mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 04:39:10 +00:00
Use stderr for exceptions (#1303)
This commit is contained in:
parent
1548792fb3
commit
9a960b9f58
23 changed files with 37 additions and 36 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue