[Zope3-checkins] SVN: zope.testing/trunk/src/zope/testing/ - fix a couple of shallow bugs when running zope.testing with Python 2.5

Benji York benji at zope.com
Thu Apr 27 15:48:43 EDT 2006


Log message for revision 67661:
  - fix a couple of shallow bugs when running zope.testing with Python 2.5
    (test's don't yet pass with 2.5, but continue to pass with 2.4)
  - minor tweak to make a regex string raw
  

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

-=-
Modified: zope.testing/trunk/src/zope/testing/doctest.py
===================================================================
--- zope.testing/trunk/src/zope/testing/doctest.py	2006-04-27 19:34:42 UTC (rev 67660)
+++ zope.testing/trunk/src/zope/testing/doctest.py	2006-04-27 19:48:43 UTC (rev 67661)
@@ -1332,13 +1332,16 @@
     __LINECACHE_FILENAME_RE = re.compile(r'<doctest '
                                          r'(?P<name>[\w\.]+)'
                                          r'\[(?P<examplenum>\d+)\]>$')
-    def __patched_linecache_getlines(self, filename):
+    def __patched_linecache_getlines(self, filename, module_globals=None):
         m = self.__LINECACHE_FILENAME_RE.match(filename)
         if m and m.group('name') == self.test.name:
             example = self.test.examples[int(m.group('examplenum'))]
             return example.source.splitlines(True)
         else:
-            return self.save_linecache_getlines(filename)
+            if module_globals is None:
+                return self.save_linecache_getlines(filename)
+            else:
+                return self.save_linecache_getlines(filename, module_globals)
 
     def run(self, test, compileflags=None, out=None, clear_globs=True):
         """

Modified: zope.testing/trunk/src/zope/testing/testrunner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.py	2006-04-27 19:34:42 UTC (rev 67660)
+++ zope.testing/trunk/src/zope/testing/testrunner.py	2006-04-27 19:48:43 UTC (rev 67661)
@@ -1619,7 +1619,7 @@
 
 default_setup_args = [
     '--tests-pattern', '^tests$',
-    '--at-level', 1,
+    '--at-level', '1',
     '--ignore', '.svn',
     '--ignore', 'CVS',
     '--ignore', '{arch}',
@@ -1775,7 +1775,6 @@
          r''),
         (re.compile('^> [^\n]+->None$', re.M), '> ...->None'),
         (re.compile('import pdb; pdb'), 'Pdb()'), # Py 2.3
-
         ])
 
     def setUp(test):
@@ -1833,7 +1832,7 @@
                     setUp=setUp, tearDown=tearDown,
                     optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
                     checker = renormalizing.RENormalizing([
-                        (re.compile('tests_profile[.]\S*[.]prof'),
+                        (re.compile(r'tests_profile[.]\S*[.]prof'),
                          'tests_profile.*.prof'),
                         ]),
                     )



More information about the Zope3-Checkins mailing list