mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
run_tests: improve exit code behavior
Rather than throw an exception when pytest itself exits non-zero, pass that back up. The traceback is never useful, only confusing. Change-Id: I0cd7bea730e13c9969154326057196295e550843 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/247175 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
6856f98467
commit
6f8c85ce2a
@ -27,14 +27,13 @@ import sys
|
|||||||
def run_pytest(cmd, argv):
|
def run_pytest(cmd, argv):
|
||||||
"""Run the unittests via |cmd|."""
|
"""Run the unittests via |cmd|."""
|
||||||
try:
|
try:
|
||||||
subprocess.check_call([cmd] + argv)
|
return subprocess.call([cmd] + argv)
|
||||||
return 0
|
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno == errno.ENOENT:
|
if e.errno == errno.ENOENT:
|
||||||
print('%s: unable to run `%s`: %s' % (__file__, cmd, e), file=sys.stderr)
|
print('%s: unable to run `%s`: %s' % (__file__, cmd, e), file=sys.stderr)
|
||||||
print('%s: Try installing pytest: sudo apt-get install python-pytest' %
|
print('%s: Try installing pytest: sudo apt-get install python-pytest' %
|
||||||
(__file__,), file=sys.stderr)
|
(__file__,), file=sys.stderr)
|
||||||
return 1
|
return 127
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user