Source

pygame / test / test_utils / run_tests.py

Diff from to

test/test_utils/run_tests.py

 import sys
 import os
 import re
-import subprocess
 import time
 import optparse
 import random
            Pygame tests
     python - the path to a python executable to run subprocessed tests
              (default sys.executable)
+    interative - allow tests tagged 'interative'.
 
     Return value:
     A tuple of total number of tests run, dictionary of error information. The
     option_fake = options.pop('fake', None)
     option_python = options.pop('python', sys.executable)
     option_exclude = options.pop('exclude', ())
+    option_interactive = options.pop('interactive', False)
 
-    if 'interactive' not in option_exclude:
+    if not option_interactive and 'interactive' not in option_exclude:
         option_exclude += ('interactive',)
     if not option_nosubprocess and 'subprocess_ignore' not in option_exclude:
         option_exclude += ('subprocess_ignore',)
     elif 'ignore' not in option_exclude:
         option_exclude += ('ignore',)
+    if sys.version_info < (3, 0, 0):
+        option_exclude += ('python2_ignore',)
+    else:
+        option_exclude += ('python3_ignore',)
 
     main_dir, test_subdir, fake_test_subdir = prepare_test_env()
     test_runner_py = os.path.join(test_subdir, "test_utils", "test_runner.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)
+