]> granicus.if.org Git - python/commitdiff
run_suite(): Factor this out of run_unittest() for tests that build
authorBarry Warsaw <barry@python.org>
Thu, 20 Sep 2001 06:30:41 +0000 (06:30 +0000)
committerBarry Warsaw <barry@python.org>
Thu, 20 Sep 2001 06:30:41 +0000 (06:30 +0000)
their own test suite from a multitude of classes (like test_email.py
will be doing).

run_unittest(): Call run_suite() after making a suite from the
testclass.

Lib/test/test_support.py

index 958acd36a7414135299855ea1c59927517b1d072..b60fcc73a1baa97d085140764d92ef66b1cb9075 100644 (file)
@@ -157,14 +157,13 @@ class BasicTestRunner:
         return result
 
 
-def run_unittest(testclass):
+def run_suite(suite):
     """Run tests from a unittest.TestCase-derived class."""
     if verbose:
         runner = unittest.TextTestRunner(sys.stdout, verbosity=2)
     else:
         runner = BasicTestRunner()
 
-    suite = unittest.makeSuite(testclass)
     result = runner.run(suite)
     if not result.wasSuccessful():
         if len(result.errors) == 1 and not result.failures:
@@ -176,6 +175,12 @@ def run_unittest(testclass):
                              % (testclass.__module__, testclass.__name__))
         raise TestFailed(err)
 
+
+def run_unittest(testclass):
+    """Run tests from a unittest.TestCase-derived class."""
+    run_suite(unittest.makeSuite(testclass))
+
+
 #=======================================================================
 # doctest driver.