[Checkins] SVN: z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/test_testsetup.py Removed dirty hack (for readline import weird characters bug) and replaced

Reinout van Rees reinout at vanrees.org
Mon Aug 31 09:00:16 EDT 2009


Log message for revision 103396:
  Removed dirty hack (for readline import weird characters bug) and replaced
  it by RENormalizing regex.

Changed:
  U   z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/test_testsetup.py

-=-
Modified: z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/test_testsetup.py
===================================================================
--- z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/test_testsetup.py	2009-08-31 12:57:23 UTC (rev 103395)
+++ z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/test_testsetup.py	2009-08-31 13:00:16 UTC (rev 103396)
@@ -1,20 +1,13 @@
 import os
+import re
 import sys
 import gc
 import unittest
 from zope.testing import doctest, cleanup, renormalizing
-from zope.testing.testrunner.tests import checker
 import zope.component.eventtesting
 from z3c.testsetup.util import get_package
 
 
-# Begin hack to fix
-# http://reinout.vanrees.org/weblog/2009/07/16/invisible-test-diff.html
-# Everything apart from 'xterm' is OK.
-os.environ['TERM'] = 'linux'
-# End hack.
-
-
 TESTFILES = ['basicsetup.txt',
              os.path.join('functional', 'functionaldoctestsetup.txt'),
              'pythontestsetup.txt',
@@ -26,6 +19,15 @@
              ]
 
 
+checker = renormalizing.RENormalizing([
+    # Relevant normalizers from zope.testing.testrunner.tests:
+    (re.compile(r'\d+[.]\d\d\d seconds'), 'N.NNN seconds'),
+    # Our own one to work around
+    # http://reinout.vanrees.org/weblog/2009/07/16/invisible-test-diff.html:
+    (re.compile(r'.*1034h'), ''),
+    ])
+
+
 def pnorm(path):
     """Normalization of paths to use forward slashes. This is needed
     to make sure the tests work on windows.
@@ -105,12 +107,12 @@
         doctest.DocFileSuite(
             'tests/README_OLD.txt', 'testgetter.txt',
             'testrunner.txt', 'README.txt',
-        package='z3c.testsetup',
-        setUp=setUp, tearDown=tearDown,
-        optionflags=(doctest.ELLIPSIS|
-                     doctest.NORMALIZE_WHITESPACE|
-                     doctest.REPORT_NDIFF),
-        checker=checker),
+            package='z3c.testsetup',
+            setUp=setUp, tearDown=tearDown,
+            optionflags=(doctest.ELLIPSIS|
+                         doctest.NORMALIZE_WHITESPACE|
+                         doctest.REPORT_NDIFF),
+            checker=checker),
         ]
 
     suite = unittest.TestSuite(suites)
@@ -146,13 +148,13 @@
 
     suites = [
         doctest.DocFileSuite(
-        'nozopeapptesting.txt',
-        package='z3c.testsetup',
-        setUp=setUp, tearDown=tearDown,
-        optionflags=(doctest.ELLIPSIS|
-                     doctest.NORMALIZE_WHITESPACE|
-                     doctest.REPORT_NDIFF),
-        checker=checker),
+            'nozopeapptesting.txt',
+            package='z3c.testsetup',
+            setUp=setUp, tearDown=tearDown,
+            optionflags=(doctest.ELLIPSIS|
+                         doctest.NORMALIZE_WHITESPACE|
+                         doctest.REPORT_NDIFF),
+            checker=checker),
         ]
 
     suite = unittest.TestSuite(suites)



More information about the checkins mailing list