[Zope3-checkins] SVN: zope.testing/branches/regebro-py3-3rdtimelucky/src/zope/testing/doctest/__init__.py Less brittle version of this monkey

Lennart Regebro regebro at gmail.com
Tue Apr 27 13:23:20 EDT 2010


Log message for revision 111504:
  Less brittle version of this monkey

Changed:
  U   zope.testing/branches/regebro-py3-3rdtimelucky/src/zope/testing/doctest/__init__.py

-=-
Modified: zope.testing/branches/regebro-py3-3rdtimelucky/src/zope/testing/doctest/__init__.py
===================================================================
--- zope.testing/branches/regebro-py3-3rdtimelucky/src/zope/testing/doctest/__init__.py	2010-04-27 17:22:40 UTC (rev 111503)
+++ zope.testing/branches/regebro-py3-3rdtimelucky/src/zope/testing/doctest/__init__.py	2010-04-27 17:23:20 UTC (rev 111504)
@@ -192,16 +192,13 @@
 # evil, but Zopes doctests did this, and if we change it everything breaks.
 import unittest
 
-def _patched_init(self, test, optionflags=0, setUp=None, tearDown=None,
-             checker=None):
-    unittest.TestCase.__init__(self)
-    self._dt_optionflags = optionflags
-    self._dt_checker = checker
-    self._dt_test = test
-    self._dt_setUp = setUp
-    self._dt_tearDown = tearDown
+def _patched_setUp(self):
+    test = self._dt_test
     self._dt_globs = test.globs.copy()
 
+    if self._dt_setUp is not None:
+        self._dt_setUp(test)
+
 def _patched_tearDown(self):
     test = self._dt_test
 
@@ -211,7 +208,7 @@
     test.globs.clear()
     test.globs.update(self._dt_globs)
 
-doctest.DocTestCase.__init__ = _patched_init
+doctest.DocTestCase.setUp = _patched_setUp
 doctest.DocTestCase.tearDown = _patched_tearDown
 
 



More information about the Zope3-Checkins mailing list