[Checkins] SVN: z3c.coverage/trunk/src/z3c/coverage/tests.py Make the tests pass on Python 2.4.

Marius Gedminas marius at pov.lt
Thu Jul 19 17:06:18 EDT 2007


Log message for revision 78196:
  Make the tests pass on Python 2.4.
  
  

Changed:
  U   z3c.coverage/trunk/src/z3c/coverage/tests.py

-=-
Modified: z3c.coverage/trunk/src/z3c/coverage/tests.py
===================================================================
--- z3c.coverage/trunk/src/z3c/coverage/tests.py	2007-07-19 20:59:21 UTC (rev 78195)
+++ z3c.coverage/trunk/src/z3c/coverage/tests.py	2007-07-19 21:06:17 UTC (rev 78196)
@@ -3,18 +3,19 @@
 Test suite for z3c.coverage
 """
 
-import unittest
+import unittest, re
+from zope.testing import doctest, renormalizing
 
-# prefer the zope.testing version, if it is available
-try:
-    from zope.testing import doctest
-except ImportError:
-    import doctest
 
-
 def test_suite():
+    checker = renormalizing.RENormalizing([
+                # optparse in Python 2.4 prints "usage:" and "options:",
+                # in 2.5 it prints "Usage:" and "Options:".
+                (re.compile('^usage:'), 'Usage:'),
+                (re.compile('^options:', re.MULTILINE), 'Options:'),
+                                           ])
     return unittest.TestSuite([
-                doctest.DocFileSuite('coveragediff.txt'),
+                doctest.DocFileSuite('coveragediff.txt', checker=checker),
                 doctest.DocTestSuite('z3c.coverage.coveragediff'),
                 doctest.DocTestSuite('z3c.coverage.coveragereport'),
                                ])



More information about the Checkins mailing list