diff options
| author | Mike Frysinger <vapier@google.com> | 2019-12-01 22:42:14 -0500 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2019-12-02 04:20:10 +0000 |
| commit | 6f8c85ce2a80ea7662939735b185113aa139c78b (patch) | |
| tree | 604e4693cfb09a0f5998dfdfa53b2a26e71c664d /run_tests | |
| parent | 6856f98467aa5c98085cdee02587dbab984cebb1 (diff) | |
| download | git-repo-6f8c85ce2a80ea7662939735b185113aa139c78b.tar.gz | |
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>
Diffstat (limited to 'run_tests')
| -rwxr-xr-x | run_tests | 5 |
1 files changed, 2 insertions, 3 deletions
| @@ -27,14 +27,13 @@ import sys | |||
| 27 | def run_pytest(cmd, argv): | 27 | def run_pytest(cmd, argv): |
| 28 | """Run the unittests via |cmd|.""" | 28 | """Run the unittests via |cmd|.""" |
| 29 | try: | 29 | try: |
| 30 | subprocess.check_call([cmd] + argv) | 30 | return subprocess.call([cmd] + argv) |
| 31 | return 0 | ||
| 32 | except OSError as e: | 31 | except OSError as e: |
| 33 | if e.errno == errno.ENOENT: | 32 | if e.errno == errno.ENOENT: |
| 34 | print('%s: unable to run `%s`: %s' % (__file__, cmd, e), file=sys.stderr) | 33 | print('%s: unable to run `%s`: %s' % (__file__, cmd, e), file=sys.stderr) |
| 35 | print('%s: Try installing pytest: sudo apt-get install python-pytest' % | 34 | print('%s: Try installing pytest: sudo apt-get install python-pytest' % |
| 36 | (__file__,), file=sys.stderr) | 35 | (__file__,), file=sys.stderr) |
| 37 | return 1 | 36 | return 127 |
| 38 | else: | 37 | else: |
| 39 | raise | 38 | raise |
| 40 | 39 | ||
