summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-09-20 06:30:41 (GMT)
committerBarry Warsaw <barry@python.org>2001-09-20 06:30:41 (GMT)
commitc10d69074467dd54a77ec0b666e6327d3de1e389 (patch)
tree9c1d5a15478e91efdabeac996954215f44c86278 /Lib/test/test_support.py
parent4bcfa317eec0eb479586be10f326aefb994ccf28 (diff)
downloadcpython-c10d69074467dd54a77ec0b666e6327d3de1e389.zip
cpython-c10d69074467dd54a77ec0b666e6327d3de1e389.tar.gz
cpython-c10d69074467dd54a77ec0b666e6327d3de1e389.tar.bz2
run_suite(): Factor this out of run_unittest() for tests that build
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.
Diffstat (limited to 'Lib/test/test_support.py')
-rw-r--r--Lib/test/test_support.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 958acd3..b60fcc7 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -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.