SF.net SVN: jython:[7230] trunk/jython/Lib/test/test_support.py

[email protected] Mon, 14 Mar 2011 02:04:08 +0000
Newsgroups gmane.comp.lang.jython.cvs
Message-ID <[email protected]>
Revision: 7230
          http://jython.svn.sourceforge.net/jython/?rev=7230&view=rev
Author:   pjenvey
Date:     2011-03-14 02:04:08 +0000 (Mon, 14 Mar 2011)

Log Message:
-----------
reapply our junit_xml hooks

Modified Paths:
--------------
    trunk/jython/Lib/test/test_support.py

Modified: trunk/jython/Lib/test/test_support.py
===================================================================
--- trunk/jython/Lib/test/test_support.py	2011-03-14 01:52:02 UTC (rev 7229)
+++ trunk/jython/Lib/test/test_support.py	2011-03-14 02:04:08 UTC (rev 7230)
@@ -826,7 +826,28 @@
 
 def _run_suite(suite):
     """Run tests from a unittest.TestSuite-derived class."""
-    if verbose:
+    if not junit_xml_dir:
+        # Splitting tests apart slightly changes the handling of the
+        # TestFailed message
+        return _run_suite(suite, testclass)
+
+    failed = False
+    for test in suite:
+        suite = unittest.TestSuite()
+        suite.addTest(test)
+        try:
+            _run_suite(suite, testclass)
+        except TestFailed, e:
+            if not failed:
+                failed = e
+    if failed:
+        raise failed
+
+def _run_suite(suite, testclass=None):
+    if junit_xml_dir:
+        from junit_xml import JUnitXMLTestRunner
+        runner = JUnitXMLTestRunner(junit_xml_dir)
+    elif verbose:
         runner = unittest.TextTestRunner(sys.stdout, verbosity=2)
     else:
         runner = BasicTestRunner()


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d