[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/event/ depend on zope.testing for DocFileSuite instead of re-implementing it locally

Fred L. Drake, Jr. fdrake at gmail.com
Tue Aug 10 18:32:01 EDT 2004


Log message for revision 26983:
  depend on zope.testing for DocFileSuite instead of re-implementing it locally


Changed:
  A   Zope3/branches/ZopeX3-3.0/src/zope/event/DEPENDENCIES.cfg
  U   Zope3/branches/ZopeX3-3.0/src/zope/event/tests.py


-=-
Added: Zope3/branches/ZopeX3-3.0/src/zope/event/DEPENDENCIES.cfg
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/event/DEPENDENCIES.cfg	2004-08-10 21:37:03 UTC (rev 26982)
+++ Zope3/branches/ZopeX3-3.0/src/zope/event/DEPENDENCIES.cfg	2004-08-10 22:32:01 UTC (rev 26983)
@@ -0,0 +1 @@
+zope.testing

Modified: Zope3/branches/ZopeX3-3.0/src/zope/event/tests.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/event/tests.py	2004-08-10 21:37:03 UTC (rev 26982)
+++ Zope3/branches/ZopeX3-3.0/src/zope/event/tests.py	2004-08-10 22:32:01 UTC (rev 26983)
@@ -16,37 +16,13 @@
 $Id$
 """
 
-import os, doctest, new, unittest
+import unittest
 
-def DocFileSuite(*paths):
-    """Utility to create doc tests from readme files
+from zope.testing import doctest
 
-    Eventually, this, or something like it, will be part of doctest
-    """
-    # 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.
-    t = doctest.Tester(globs={'__name__': '__main__'})
-    suite = unittest.TestSuite()
-    dir = os.path.split(__file__)[0]
-    for path in paths:
-        path = os.path.join(dir, path)
-        source = open(path).read()
-        def runit(path=path, source=source):
-            doctest._utest(t, path, source, path, 0)
-        runit = new.function(runit.func_code, runit.func_globals, path,
-                             runit.func_defaults, runit.func_closure)
-        f = unittest.FunctionTestCase(runit,
-                                      description="doctest from %s" % path)
-        suite.addTest(f)
-    return suite
 
 def test_suite():
-    return unittest.TestSuite((
-        DocFileSuite('README.txt'),
-        ))
+    return doctest.DocFileSuite('README.txt')
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')



More information about the Zope3-Checkins mailing list