[Zope3-checkins] SVN: zope.testing/trunk/src/zope/testing/testrunner/find.py LP #221151: Keep unittest.TestCase.shortDescription happy via

Roman Joost rj at gocept.com
Sat Jun 19 04:40:18 EDT 2010


Log message for revision 113633:
  LP #221151: Keep unittest.TestCase.shortDescription happy via
  _testMethodDoc attribute.
  
  

Changed:
  U   zope.testing/trunk/src/zope/testing/testrunner/find.py

-=-
Modified: zope.testing/trunk/src/zope/testing/testrunner/find.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/find.py	2010-06-19 05:48:59 UTC (rev 113632)
+++ zope.testing/trunk/src/zope/testing/testrunner/find.py	2010-06-19 08:40:16 UTC (rev 113633)
@@ -36,9 +36,13 @@
     Normally the StartUpFailure just acts as an empty test suite to satisfy
     the test runner and statistics:
     
-    >>> s = StartUpFailure(options, None, None)
+    >>> s = StartUpFailure(options, 'fauxmodule', None)
+    >>> s
+    <StartUpFailure module=fauxmodule>
     >>> isinstance(s,unittest.TestCase)
     True
+    >>> s.shortDescription()
+    'StartUpFailure: import errors in fauxmodule.'
 
     However, if the post mortem option is enabled:
 
@@ -74,7 +78,7 @@
     Traceback (most recent call last):
     EndRun
 
-    Annoyingly, sometimes StartupFailures occur when postmortem debugging
+    Annoyingly, sometimes StartUpFailures occur when postmortem debugging
     is enabled but no exc_info is passed. In this case, we raise a
     sensible exception rather than letting the debugger barf with an
     AttributeError:
@@ -86,6 +90,11 @@
     TypeError: If post_mortem is specified, full exc_info must be passed!
     """
 
+    def _getTestMethodDoc(self):
+        return 'StartUpFailure: import errors in %s.' % self.module
+
+    _testMethodDoc = property(_getTestMethodDoc,)
+
     def __init__(self, options, module, exc_info):
         if options.post_mortem:
             for item in exc_info:



More information about the Zope3-Checkins mailing list