[Checkins] SVN: grok/trunk/src/grok/tests/test_grok.py Make unittest pass on Python 2.5:

Philipp von Weitershausen philikon at philikon.de
Sat Sep 1 13:37:52 EDT 2007


Log message for revision 79428:
  Make unittest pass on Python 2.5:
  
  str(Exception) has changed from Python 2.4 to 2.5 (due to
  Exception now being a new-style class), which changes the way
  exceptions appear in traceback printouts.  Fixed by renormalizing
  the output.
  
  

Changed:
  U   grok/trunk/src/grok/tests/test_grok.py

-=-
Modified: grok/trunk/src/grok/tests/test_grok.py
===================================================================
--- grok/trunk/src/grok/tests/test_grok.py	2007-09-01 14:55:12 UTC (rev 79427)
+++ grok/trunk/src/grok/tests/test_grok.py	2007-09-01 17:37:52 UTC (rev 79428)
@@ -1,6 +1,7 @@
+import re
 import unittest
 from pkg_resources import resource_listdir
-from zope.testing import doctest, cleanup
+from zope.testing import doctest, cleanup, renormalizing
 import zope.component.eventtesting
 
 def setUpZope(test):
@@ -9,6 +10,14 @@
 def cleanUpZope(test):
     cleanup.cleanUp()
 
+checker = renormalizing.RENormalizing([
+    # str(Exception) has changed from Python 2.4 to 2.5 (due to
+    # Exception now being a new-style class).  This changes the way
+    # exceptions appear in traceback printouts.
+    (re.compile(r"ConfigurationExecutionError: <class '([\w.]+)'>:"),
+                r'ConfigurationExecutionError: \1:'),
+    ])
+
 def suiteFromPackage(name):
     files = resource_listdir(__name__, name)
     suite = unittest.TestSuite()
@@ -24,6 +33,7 @@
         test = doctest.DocTestSuite(dottedname,
                                     setUp=setUpZope,
                                     tearDown=cleanUpZope,
+                                    checker=checker,
                                     optionflags=doctest.ELLIPSIS+
                                     doctest.NORMALIZE_WHITESPACE)
 



More information about the Checkins mailing list