[pypy-svn] rev 2527 - pypy/trunk/src/pypy/appspace

pmaupin at codespeak.net pmaupin at codespeak.net
Thu Dec 18 18:15:40 CET 2003


Author: pmaupin
Date: Thu Dec 18 18:15:39 2003
New Revision: 2527

Modified:
   pypy/trunk/src/pypy/appspace/support_tests.py
Log:
Remove unittest functionality -- change to use PyPy unit tests

Modified: pypy/trunk/src/pypy/appspace/support_tests.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/support_tests.py	(original)
+++ pypy/trunk/src/pypy/appspace/support_tests.py	Thu Dec 18 18:15:39 2003
@@ -188,86 +188,3 @@
         pass
     else:
         print 'Missing SyntaxError: "%s"' % statement
-
-#=======================================================================
-# Preliminary PyUNIT integration.
-
-import unittest
-
-
-class BasicTestRunner:
-    def run(self, test):
-        result = unittest.TestResult()
-        test(result)
-        return result
-
-
-def run_suite(suite, testclass=None):
-    """Run tests from a unittest.TestSuite-derived class."""
-    if verbose:
-        runner = unittest.TextTestRunner(sys.stdout, verbosity=2)
-    else:
-        runner = BasicTestRunner()
-
-    result = runner.run(suite)
-    if not result.wasSuccessful():
-        if len(result.errors) == 1 and not result.failures:
-            err = result.errors[0][1]
-        elif len(result.failures) == 1 and not result.errors:
-            err = result.failures[0][1]
-        else:
-            if testclass is None:
-                msg = "errors occurred; run in verbose mode for details"
-            else:
-                msg = "errors occurred in %s.%s" \
-                      % (testclass.__module__, testclass.__name__)
-            raise TestFailed(msg)
-        raise TestFailed(err)
-
-
-def run_unittest(*classes):
-    """Run tests from unittest.TestCase-derived classes."""
-    suite = unittest.TestSuite()
-    for cls in classes:
-        if isinstance(cls, (unittest.TestSuite, unittest.TestCase)):
-            suite.addTest(cls)
-        else:
-            suite.addTest(unittest.makeSuite(cls))
-    if len(classes)==1:
-        testclass = classes[0]
-    else:
-        testclass = None
-    run_suite(suite, testclass)
-
-
-#=======================================================================
-# doctest driver.
-
-def run_doctest(module, verbosity=None):
-    """Run doctest on the given module.  Return (#failures, #tests).
-
-    If optional argument verbosity is not specified (or is None), pass
-    test_support's belief about verbosity on to doctest.  Else doctest's
-    usual behavior is used (it searches sys.argv for -v).
-    """
-
-    import doctest
-
-    if verbosity is None:
-        verbosity = verbose
-    else:
-        verbosity = None
-
-    # Direct doctest output (normally just errors) to real stdout; doctest
-    # output shouldn't be compared by regrtest.
-    save_stdout = sys.stdout
-    sys.stdout = get_original_stdout()
-    try:
-        f, t = doctest.testmod(module, verbose=verbosity)
-        if f:
-            raise TestFailed("%d of %d doctests failed" % (f, t))
-    finally:
-        sys.stdout = save_stdout
-    if verbose:
-        print 'doctest (%s) ... %d tests with zero failures' % (module.__name__, t)
-    return f, t


More information about the Pypy-commit mailing list