Commits

illume committed 16b51ab Merge

Merged in takluyver/pygame/tests-returncode (pull request #17: Use a return code of 1 when the tests fail)

Comments (0)

Files changed (2)

     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:
 
 ###########################################################################
 # Run the test suite.
-run(*args, **kwds)
+run_and_exit(*args, **kwds)
 
 

test/test_utils/run_tests.py

 
     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)
+