Skip to content

Commit

Permalink
runtests.py: exit with status 1 if there are errors or failing tests
Browse files Browse the repository at this point in the history
Before this changeset runtests.py would exit with status code 0
even when tests were failing, tricking Travis-CI into thinking a
build was successful.
  • Loading branch information
lvillani committed Jun 17, 2014
1 parent c508ad3 commit 7bd5571
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,13 @@ def run_tests(test_suite, xml_file):
# Text from stdout/stderr should be added to failed test cases.
result.buffer = True
result.startTestRun()
test_suite.run(result)
ret = test_suite.run(result)
result.stopTestRun()
fp.close()

return ret
else:
unittest.TextTestRunner(verbosity=2).run(test_suite)
return unittest.TextTestRunner(verbosity=2).run(test_suite)


def main():
Expand Down Expand Up @@ -738,7 +740,10 @@ def main():

# Run created test suite.
clean()
run_tests(suite, opts.junitxml)

result = run_tests(suite, opts.junitxml)

sys.exit(int(bool(result.failures or result.errors)))


if __name__ == '__main__':
Expand Down

0 comments on commit 7bd5571

Please sign in to comment.