# HG changeset patch # User Thomas Kluyver # Date 1357726437 0 # Node ID d1b367fc08bcfdafdbf1dff93eff7dac35c87ae0 # Parent 17bf68ccad37b5cdc062d52d4339a9d776b04b8d Use a return code of 1 when the tests fail. diff -r 17bf68ccad37 -r d1b367fc08bc test/__main__.py --- a/test/__main__.py Tue Jan 08 14:05:02 2013 +0100 +++ b/test/__main__.py Wed Jan 09 10:13:57 2013 +0000 @@ -26,10 +26,10 @@ is_pygame_pkg = __name__.startswith('pygame.tests.') if is_pygame_pkg: - from pygame.tests.test_utils.run_tests import run + from pygame.tests.test_utils.run_tests import run_and_exit from pygame.tests.test_utils.test_runner import opt_parser else: - from test.test_utils.run_tests import run + from test.test_utils.run_tests import run_and_exit from test.test_utils.test_runner import opt_parser if is_pygame_pkg: @@ -128,6 +128,6 @@ ########################################################################### # Run the test suite. -run(*args, **kwds) +run_and_exit(*args, **kwds) diff -r 17bf68ccad37 -r d1b367fc08bc test/test_utils/run_tests.py --- a/test/test_utils/run_tests.py Tue Jan 08 14:05:02 2013 +0100 +++ b/test/test_utils/run_tests.py Wed Jan 09 10:13:57 2013 +0000 @@ -317,5 +317,15 @@ return total, fails -############################################################################### +def run_and_exit(*args, **kwargs): + """Run the tests, and if there are failures, exit with a return code of 1. + + This is needed for various buildbots to recognise that the tests have + failed. + """ + total, fails = run(*args, **kwargs) + if fails: + sys.exit(1) + sys.exit(0) +