Skip to content

Commit

Permalink
refactor(run_tests): python 2/3 compatibility
Browse files Browse the repository at this point in the history
That way, it will run on travis as well, which comes with python 2
by default, and just doesn't have python 3 pre-installed.
It would probably take to much time to install, especially considering
it's super easy to have to script work in both worlds.
  • Loading branch information
Byron authored and kbknapp committed May 5, 2015
1 parent c0e3835 commit d3761a2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions clap-tests/run_tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
import sys
import subprocess

Expand Down Expand Up @@ -260,7 +260,7 @@

def pass_fail(name, check, good):
global failed
print(name, end='')
sys.stdout.write(name)
if check == good:
print('Pass')
return
Expand All @@ -270,9 +270,9 @@ def pass_fail(name, check, good):

def main():
for cmd, cmd_v in cmds.items():
with subprocess.Popen(cmd_v[0], shell=True, stdout=subprocess.PIPE, universal_newlines=True) as proc:
out = proc.communicate()[0].strip()
pass_fail(cmd, out, cmd_v[1])
proc = subprocess.Popen(cmd_v[0], shell=True, stdout=subprocess.PIPE, universal_newlines=True)
out = proc.communicate()[0].strip()
pass_fail(cmd, out, cmd_v[1])
if failed:
print('One or more tests failed')
return 1
Expand Down

0 comments on commit d3761a2

Please sign in to comment.