From 6f8c85ce2a80ea7662939735b185113aa139c78b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 1 Dec 2019 22:42:14 -0500 Subject: [PATCH] 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 Tested-by: Mike Frysinger --- run_tests | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/run_tests b/run_tests index f72b22c5..1b35aded 100755 --- a/run_tests +++ b/run_tests @@ -27,14 +27,13 @@ import sys def run_pytest(cmd, argv): """Run the unittests via |cmd|.""" try: - subprocess.check_call([cmd] + argv) - return 0 + return subprocess.call([cmd] + argv) except OSError as e: if e.errno == errno.ENOENT: print('%s: unable to run `%s`: %s' % (__file__, cmd, e), file=sys.stderr) print('%s: Try installing pytest: sudo apt-get install python-pytest' % (__file__,), file=sys.stderr) - return 1 + return 127 else: raise