[Zope3-checkins] SVN: Zope3/trunk/src/zope/interface/tests/ Changed to use DocFileSuite from zope.testing, since we depend on

Jim Fulton jim at zope.com
Fri Aug 6 18:33:20 EDT 2004


Log message for revision 26948:
    Changed to use DocFileSuite from zope.testing, since we depend on
    zope.testing anyway.
  
  


Changed:
  D   Zope3/trunk/src/zope/interface/tests/docfilesuite.py
  U   Zope3/trunk/src/zope/interface/tests/test_adapter.py
  U   Zope3/trunk/src/zope/interface/tests/test_interface.py


-=-
Deleted: Zope3/trunk/src/zope/interface/tests/docfilesuite.py
===================================================================
--- Zope3/trunk/src/zope/interface/tests/docfilesuite.py	2004-08-06 22:30:48 UTC (rev 26947)
+++ Zope3/trunk/src/zope/interface/tests/docfilesuite.py	2004-08-06 22:33:20 UTC (rev 26948)
@@ -1,44 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Utility to create doc tests from readme files
-
-$Id$
-"""
-
-import os, doctest, new, unittest
-
-def DocFileSuite(*paths):
-    """Utility to create doc tests from readme files
-
-    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.dirname(__file__)
-    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

Modified: Zope3/trunk/src/zope/interface/tests/test_adapter.py
===================================================================
--- Zope3/trunk/src/zope/interface/tests/test_adapter.py	2004-08-06 22:30:48 UTC (rev 26947)
+++ Zope3/trunk/src/zope/interface/tests/test_adapter.py	2004-08-06 22:33:20 UTC (rev 26948)
@@ -134,9 +134,10 @@
 
 
 def test_suite():
-    from docfilesuite import DocFileSuite
+    from zope.testing.doctestunit import DocFileSuite
     return unittest.TestSuite((
-        DocFileSuite('../adapter.txt', 'foodforthought.txt'),
+        DocFileSuite('../adapter.txt', 'foodforthought.txt',
+                     globs={'__name__': '__main__'}),
         doctest.DocTestSuite(),
         ))
 

Modified: Zope3/trunk/src/zope/interface/tests/test_interface.py
===================================================================
--- Zope3/trunk/src/zope/interface/tests/test_interface.py	2004-08-06 22:30:48 UTC (rev 26947)
+++ Zope3/trunk/src/zope/interface/tests/test_interface.py	2004-08-06 22:33:20 UTC (rev 26948)
@@ -273,10 +273,11 @@
 
 
 def test_suite():
-    from docfilesuite import DocFileSuite
+    from zope.testing.doctestunit import DocFileSuite
     suite = unittest.makeSuite(InterfaceTests)
     suite.addTest(DocTestSuite("zope.interface.interface"))
-    suite.addTest(DocFileSuite('../README.txt'))
+    suite.addTest(DocFileSuite('../README.txt',
+                               globs={'__name__': '__main__'}))
     return suite
 
 def main():



More information about the Zope3-Checkins mailing list