Skip to content

Commit

Permalink
return the exit code 1 in case of test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
tranchitella committed Aug 18, 2009
1 parent a2d7317 commit cd39bd1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
CHANGES
=======

0.9 (unreleased)
================

- Test runner: return the exit code 1 in case of test failures; this simplifies
buildbot configurations.

0.8 (2009-08-17)
================

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = '0.8.0'
version = '0.9.0dev'

import os
from setuptools import setup, find_packages
Expand Down
5 changes: 4 additions & 1 deletion src/z3c/recipe/compattest/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def poll(self):
self.output.write(data.replace('\r\n', '\n'))


def main(max_jobs, *scripts):
def main(max_jobs, *scripts, **options):
argv = sys.argv[1:]
if '-h' in argv or '--help' in argv:
usage()
Expand Down Expand Up @@ -113,3 +113,6 @@ def main(max_jobs, *scripts):
pass
else:
pickle.dump(stats, stat_file)

if not options.get('no_exit_code') and failures:
sys.exit(1)
5 changes: 3 additions & 2 deletions src/z3c/recipe/compattest/runner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ failures.
... """)

>>> from z3c.recipe.compattest.runner import main
>>> main(1, ok_script, failure_script)
>>> main(1, ok_script, failure_script, no_exit_code=True)
Running test-ok
Running test-failure
test-failure failed with:
Expand All @@ -43,7 +43,8 @@ failures.
Note that when we pass a number greater than 1 as the first argument,
tests are run in parallel, so the order of output varies.

>>> main(2, failure_script, ok_script, failure_script, ok_script)
>>> main(2, failure_script, ok_script, failure_script, ok_script, \
... no_exit_code=True)
Running ...
2 failure(s).
- test-failure
Expand Down

0 comments on commit cd39bd1

Please sign in to comment.