mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
refactor(run_tests): python 2/3 compatibility
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.
This commit is contained in:
parent
c0e383515d
commit
d3761a2c20
1 changed files with 5 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
|
@ -260,7 +260,7 @@ cmds = {'help short: ': ['{} -h'.format(_bin), _help],
|
|||
|
||||
def pass_fail(name, check, good):
|
||||
global failed
|
||||
print(name, end='')
|
||||
sys.stdout.write(name)
|
||||
if check == good:
|
||||
print('Pass')
|
||||
return
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue