Port install_test to python3

This commit is contained in:
Parsa Ghadimi 2018-09-07 13:06:45 +04:30 committed by Ryan Dahl
parent 6d05a247d6
commit 6dbf1ffb3a

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# Copyright 2018 the Deno authors. All rights reserved. MIT license. # Copyright 2018 the Deno authors. All rights reserved. MIT license.
# TODO travis and appveyor. test on python 2 and 3. from __future__ import print_function
import sys import sys
import shutil import shutil
import os import os
@ -14,7 +15,7 @@ def main():
PATTERN = "DENO_EXE: " PATTERN = "DENO_EXE: "
home = os.path.expanduser("~") home = os.path.expanduser("~")
expected_bin_dir = os.path.join(home, ".deno", "bin") expected_bin_dir = os.path.join(home, ".deno", "bin")
print "Testing install.py ... Expect deno installed to ", expected_bin_dir print("Testing install.py ... Expect deno installed to ", expected_bin_dir)
if os.path.exists(expected_bin_dir): if os.path.exists(expected_bin_dir):
shutil.rmtree(expected_bin_dir) shutil.rmtree(expected_bin_dir)
expected_fn = os.path.join(expected_bin_dir, "deno") expected_fn = os.path.join(expected_bin_dir, "deno")
@ -23,9 +24,9 @@ def main():
out = subprocess.check_output(cmd, universal_newlines=True) out = subprocess.check_output(cmd, universal_newlines=True)
actual_fn = None actual_fn = None
for line in out.splitlines(): for line in out.splitlines():
print line print(line)
if PATTERN in line: if PATTERN in line:
print "set actual" print("set actual")
actual_fn = line[len(PATTERN):] actual_fn = line[len(PATTERN):]
assert actual_fn == expected_fn, "actual %s != expected %s" % (actual_fn, assert actual_fn == expected_fn, "actual %s != expected %s" % (actual_fn,
expected_fn) expected_fn)