[Zodb-checkins] SVN: ZODB/branches/tim-simpler_connection/src/persistent/tests/test_persistent.py Until we can rely on Python 2.4, take DocFileSuite from

Tim Peters tim.one at comcast.net
Tue Oct 26 14:02:20 EDT 2004


Log message for revision 28253:
  Until we can rely on Python 2.4, take DocFileSuite from
  zope.testing instead of rolling our own.
  

Changed:
  U   ZODB/branches/tim-simpler_connection/src/persistent/tests/test_persistent.py

-=-
Modified: ZODB/branches/tim-simpler_connection/src/persistent/tests/test_persistent.py
===================================================================
--- ZODB/branches/tim-simpler_connection/src/persistent/tests/test_persistent.py	2004-10-26 16:32:32 UTC (rev 28252)
+++ ZODB/branches/tim-simpler_connection/src/persistent/tests/test_persistent.py	2004-10-26 18:02:20 UTC (rev 28253)
@@ -19,36 +19,13 @@
 import persistent.tests
 from persistent import Persistent
 
+from zope.testing.doctestunit import DocFileSuite
+
 class P(Persistent):
     def __init__(self):
         self.x = 0
     def inc(self):
         self.x += 1
 
-try:
-    DocFileSuite = doctest.DocFileSuite # >= Python 2.4.0a2
-except AttributeError:
-    # <= Python 2.4.0a1
-    def DocFileSuite(path, globs=None):
-        # It's not entirely obvious how to connection this single string
-        # with unittest.  For now, re-use the _utest() function that comes
-        # standard with doctest in Python 2.3.  One problem is that the
-        # error indicator doesn't point to the line of the doctest file
-        # that failed.
-
-        path = os.path.join(persistent.tests.__path__[0], path)
-        
-        source = open(path).read()
-        if globs is None:
-            globs = sys._getframe(1).f_globals
-        t = doctest.Tester(globs=globs)
-        def runit():
-            doctest._utest(t, path, source, path, 0)
-        f = unittest.FunctionTestCase(runit,
-                                      description="doctest from %s" % path)
-        suite = unittest.TestSuite()
-        suite.addTest(f)
-        return suite
-
 def test_suite():
     return DocFileSuite("persistent.txt", globs={"P": P})



More information about the Zodb-checkins mailing list