[Checkins] SVN: z3c.testsetup/trunk/ Do not use zope.testing.doctest anymore.

Uli Fouquet uli at gnufix.de
Wed May 19 03:30:35 EDT 2010


Log message for revision 112508:
  Do not use zope.testing.doctest anymore.

Changed:
  U   z3c.testsetup/trunk/CHANGES.txt
  U   z3c.testsetup/trunk/src/z3c/testsetup/README.txt
  U   z3c.testsetup/trunk/src/z3c/testsetup/doctesting.py
  U   z3c.testsetup/trunk/src/z3c/testsetup/functional/doctesting.py
  U   z3c.testsetup/trunk/src/z3c/testsetup/functional/functionaldoctestsetup.txt
  U   z3c.testsetup/trunk/src/z3c/testsetup/nozopeapptesting.txt
  U   z3c.testsetup/trunk/src/z3c/testsetup/testrunner.txt
  U   z3c.testsetup/trunk/src/z3c/testsetup/tests/cave/globstest.chk
  U   z3c.testsetup/trunk/src/z3c/testsetup/tests/setupininit.txt
  U   z3c.testsetup/trunk/src/z3c/testsetup/tests/test_testsetup.py
  U   z3c.testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt

-=-
Modified: z3c.testsetup/trunk/CHANGES.txt
===================================================================
--- z3c.testsetup/trunk/CHANGES.txt	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/CHANGES.txt	2010-05-19 07:30:34 UTC (rev 112508)
@@ -14,6 +14,8 @@
   availble when trying to run a functional doc test. This error presented
   itself as a highly cryptic ImportError when actually running tests.
 
+- Use standard lib doctest instead of zope.testing.doctest.
+
 0.6.1 (2009-11-19)
 ==================
 

Modified: z3c.testsetup/trunk/src/z3c/testsetup/README.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/README.txt	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/src/z3c/testsetup/README.txt	2010-05-19 07:30:34 UTC (rev 112508)
@@ -37,8 +37,9 @@
 in the ``tests/`` subdirectory if you've downloaded the source code):
 
   >>> import os
-  >>> cavepath = os.path.dirname(__file__)
-  >>> cavepath = os.path.join(cavepath, 'tests', 'othercave')
+  >>> import z3c.testsetup
+  >>> pkgpath = os.path.dirname(z3c.testsetup.__file__)
+  >>> cavepath = os.path.join(pkgpath, 'tests', 'othercave')
 
 
 Registering doctests
@@ -137,9 +138,9 @@
       Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
         Custom setUp for  <DocTest doctest05.txt from ...doctest05.txt:0 (2 examples)>
         Custom tearDown for  <DocTest doctest05.txt from ...doctest05.txt:0 (2 examples)>
-      Ran 7 tests with 0 failures and 0 errors in 0.011 seconds.
+      Ran 4 tests with 0 failures and 0 errors in 0.011 seconds.
       Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
-    Total: 13 tests, 0 failures, 0 errors in 11.798 seconds.
+    Total: 10 tests, 0 failures, 0 errors in 11.798 seconds.
     False
 
 As we can see, there were regular unittests as well as functional tests
@@ -485,7 +486,7 @@
 - ``:zcml-layer: <ZCML_filename>``
 
   Use the given ZCML file and run tests in this file on a ZCML
-  layer. Tests are registered using ``zope.testing.doctest.DocFileSuite``.
+  layer. Tests are registered using ``doctest.DocFileSuite``.
 
 - ``:functional-zcml-layer: <ZCML_filename>``
 
@@ -663,7 +664,7 @@
 Sometimes we want tests to be registered using the
 ``FunctionalDocFileSuite`` function from
 ``zope.app.testing.functional`` (other tests are set up using
-``zope.testing.doctest.DocFileSuite``). This function pulls in even
+``doctest.DocFileSuite``). This function pulls in even
 more functions into ``globs``, like ``http`` (a ``HTTPCaller``
 instance), wraps your ``setUp`` and ``tearDown`` methods into
 ZODB-setups and several things more. See the definition in

Modified: z3c.testsetup/trunk/src/z3c/testsetup/doctesting.py
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/doctesting.py	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/src/z3c/testsetup/doctesting.py	2010-05-19 07:30:34 UTC (rev 112508)
@@ -13,10 +13,11 @@
 ##############################################################################
 """Test setup helpers for doctests.
 """
+import doctest
 import unittest
 import os.path
 from os import listdir
-from zope.testing import doctest, cleanup
+from zope.testing import cleanup
 from z3c.testsetup.base import BasicTestSetup
 from z3c.testsetup.util import (get_package, get_marker_from_file, warn,
                                 get_attribute)

Modified: z3c.testsetup/trunk/src/z3c/testsetup/functional/doctesting.py
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/functional/doctesting.py	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/src/z3c/testsetup/functional/doctesting.py	2010-05-19 07:30:34 UTC (rev 112508)
@@ -13,9 +13,10 @@
 ##############################################################################
 """Test setup helpers for functional doctests.
 """
+import doctest
 import unittest
 import os.path
-from zope.testing import doctest, cleanup
+from zope.testing import cleanup
 from zope.app.testing.functional import (
     HTTPCaller, getRootFolder, sync, ZCMLLayer, FunctionalDocFileSuite,
     FunctionalTestSetup)

Modified: z3c.testsetup/trunk/src/z3c/testsetup/functional/functionaldoctestsetup.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/functional/functionaldoctestsetup.txt	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/src/z3c/testsetup/functional/functionaldoctestsetup.txt	2010-05-19 07:30:34 UTC (rev 112508)
@@ -162,7 +162,7 @@
 * The setup-instance's `optionsflags` attribute is passed. It
   includes by default the following doctest constants:
 
-     >>> from zope.testing import doctest
+     >>> import doctest
      >>> setup.optionflags == (doctest.ELLIPSIS+
      ...                       doctest.NORMALIZE_WHITESPACE |
      ...                       doctest.REPORT_NDIFF)
@@ -325,9 +325,9 @@
 
 - `optionflags`
 
-    See the `zope.testing.doctest` module for all optionflags::
+    See the `doctest` module for all optionflags::
 
-       >>> from zope.testing import doctest
+       >>> import doctest
        >>> mysetup = FunctionalDocTestSetup(
        ...     cave, optionflags=(doctest.ELLIPSIS +
        ...                        doctest.REPORT_UDIFF))
@@ -463,8 +463,10 @@
 
    >>> from zope.app.testing.functional import ZCMLLayer
    >>> import os.path
+   >>> import z3c.testsetup
+   >>> pkgpath = os.path.dirname(z3c.testsetup.__file__)
    >>> mylayer = ZCMLLayer(
-   ...     os.path.join(os.path.dirname(__file__), 'ftesting.zcml'),
+   ...     os.path.join(pkgpath, 'functional', 'ftesting.zcml'),
    ...     __name__,
    ...     'MyFunctionalLayer')
 

Modified: z3c.testsetup/trunk/src/z3c/testsetup/nozopeapptesting.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/nozopeapptesting.txt	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/src/z3c/testsetup/nozopeapptesting.txt	2010-05-19 07:30:34 UTC (rev 112508)
@@ -23,7 +23,9 @@
 package of the ``tests``::
 
     >>> import os
-    >>> cavepath = os.path.join(os.path.dirname(__file__), 'tests', 'cave')
+    >>> import z3c.testsetup
+    >>> pkgpath = os.path.dirname(z3c.testsetup.__file__)
+    >>> cavepath = os.path.join(pkgpath, 'tests', 'cave')
     >>> setupfile = os.path.join(cavepath, 'samplesetup_short0.py')
     >>> print open(setupfile).read()
     import z3c.testsetup

Modified: z3c.testsetup/trunk/src/z3c/testsetup/testrunner.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/testrunner.txt	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/src/z3c/testsetup/testrunner.txt	2010-05-19 07:30:34 UTC (rev 112508)
@@ -12,7 +12,9 @@
 two lines of code::
 
     >>> import os
-    >>> cavepath = os.path.join(os.path.dirname(__file__), 'tests', 'cave')
+    >>> import z3c.testsetup
+    >>> pkgpath = os.path.dirname(z3c.testsetup.__file__)
+    >>> cavepath = os.path.join(pkgpath, 'tests', 'cave')
     >>> setupfile = os.path.join(cavepath, 'samplesetup_short0.py')
     >>> print open(setupfile).read()
     import z3c.testsetup
@@ -297,9 +299,9 @@
       Tear down z3c.testsetup...doctesting.FunctionalLayer ...
       Running in a subprocess.
       Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
-      Ran 2 tests with 0 failures and 0 errors in N.NNN seconds.
+      Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
       Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
-    Total: 4 tests, 0 failures, 0 errors in N.NNN seconds.
+    Total: 3 tests, 0 failures, 0 errors in N.NNN seconds.
     False
 
 The same setup, but without a modified checker will deliver::
@@ -340,7 +342,9 @@
     <BLANKLINE>
     <BLANKLINE>
     Failure in test /.../z3c/testsetup/tests/cave/checkertest.chk
-    Failed doctest test for checkertest.chk
+    Traceback (most recent call last):
+    ...
+    AssertionError: Failed doctest test for checkertest.chk
       File "/.../z3c/testsetup/tests/cave/checkertest.chk", line 0
     <BLANKLINE>
     ----------------------------------------------------------------------
@@ -358,9 +362,9 @@
         - A memory address at <SOME ADDRESS>
         + A memory address at 0x1a0322ff
     <BLANKLINE>
-      Ran 2 tests with 1 failures and 0 errors in ... seconds.
+      Ran 1 tests with 1 failures and 0 errors in ... seconds.
       Tear down zope.testing.testrunner.layer.UnitTests in ... seconds.
-    Total: 4 tests, 2 failures, 0 errors in ... seconds.
+    Total: 3 tests, 2 failures, 0 errors in ... seconds.
     True
 
 Note that in older versions of `z3c.testsetup` checkers were supported
@@ -552,8 +556,9 @@
 two lines of code::
 
     >>> import os
-    >>> cavepath = os.path.join(os.path.dirname(__file__), 'tests',
-    ...   'layered_cave')
+    >>> import z3c.testsetup
+    >>> pkgpath = os.path.dirname(z3c.testsetup.__file__)
+    >>> cavepath = os.path.join(pkgpath, 'tests', 'layered_cave')
     >>> setupfile = os.path.join(cavepath, 'layeredsetup01.py')
     >>> print open(setupfile).read()
     from z3c.testsetup import register_all_tests

Modified: z3c.testsetup/trunk/src/z3c/testsetup/tests/cave/globstest.chk
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/tests/cave/globstest.chk	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/src/z3c/testsetup/tests/cave/globstest.chk	2010-05-19 07:30:34 UTC (rev 112508)
@@ -8,5 +8,6 @@
 provide us a ``basename`` function, which we do not have to define nor
 import here::
 
-  >>> basename(__file__)
-  'globstest.chk'
+  >>> import z3c.testsetup
+  >>> basename(z3c.testsetup.__file__)
+  '__init__...'

Modified: z3c.testsetup/trunk/src/z3c/testsetup/tests/setupininit.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/tests/setupininit.txt	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/src/z3c/testsetup/tests/setupininit.txt	2010-05-19 07:30:34 UTC (rev 112508)
@@ -5,7 +5,9 @@
 a test setup in the cave package::
 
     >>> import os
-    >>> cavepath = os.path.join(os.path.dirname(__file__), 'cave')
+    >>> import z3c.testsetup
+    >>> pkgpath = os.path.dirname(z3c.testsetup.__file__)
+    >>> cavepath = os.path.join(pkgpath, 'tests', 'cave')
 
 The setup looks like this::
 

Modified: z3c.testsetup/trunk/src/z3c/testsetup/tests/test_testsetup.py
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/tests/test_testsetup.py	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/src/z3c/testsetup/tests/test_testsetup.py	2010-05-19 07:30:34 UTC (rev 112508)
@@ -1,3 +1,4 @@
+import doctest
 import os
 import re
 import sys
@@ -3,5 +4,5 @@
 import gc
 import unittest
-from zope.testing import doctest, cleanup, renormalizing
+from zope.testing import cleanup, renormalizing
 import zope.component.eventtesting
 from z3c.testsetup.util import get_package

Modified: z3c.testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt	2010-05-19 06:21:47 UTC (rev 112507)
+++ z3c.testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt	2010-05-19 07:30:34 UTC (rev 112508)
@@ -153,7 +153,7 @@
 * The setup-instance's `optionsflags` attribute is passed. It
   includes by default the following doctest constants:
 
-     >>> from zope.testing import doctest
+     >>> import doctest
      >>> setup.optionflags == (doctest.ELLIPSIS+
      ...                       doctest.NORMALIZE_WHITESPACE |
      ...                       doctest.REPORT_NDIFF)



More information about the checkins mailing list