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

Fred L. Drake, Jr. fdrake at gmail.com
Tue Aug 10 17:37:04 EDT 2004


Log message for revision 26982:
  Changed to use DocFileSuite from zope.testing, since we depend on
  zope.testing anyway.
  
  (merged from Zope 3 trunk revision 26948)
  


Changed:
  D   Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/docfilesuite.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/test_adapter.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/test_interface.py


-=-
Deleted: Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/docfilesuite.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/docfilesuite.py	2004-08-10 21:26:12 UTC (rev 26981)
+++ Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/docfilesuite.py	2004-08-10 21:37:03 UTC (rev 26982)
@@ -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.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

Modified: Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/test_adapter.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/test_adapter.py	2004-08-10 21:26:12 UTC (rev 26981)
+++ Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/test_adapter.py	2004-08-10 21:37:03 UTC (rev 26982)
@@ -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/branches/ZopeX3-3.0/src/zope/interface/tests/test_interface.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/test_interface.py	2004-08-10 21:26:12 UTC (rev 26981)
+++ Zope3/branches/ZopeX3-3.0/src/zope/interface/tests/test_interface.py	2004-08-10 21:37:03 UTC (rev 26982)
@@ -270,10 +270,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