Skip to content

Commit

Permalink
Merge pull request #141 from lvillani/runtests-exit-code
Browse files Browse the repository at this point in the history
runtests.py: exit with status 1 if there are errors or failing tests.
  • Loading branch information
matysek committed Jun 21, 2014
2 parents c508ad3 + 7bd5571 commit 34be811
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/runtests.py
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 34be811

Please sign in to comment.