[Checkins] SVN: z3c.testsetup/trunk/src/z3c/testsetup/testrunner.txt Update checker tests.

Uli Fouquet uli at gnufix.de
Fri Sep 11 10:26:53 EDT 2009


Log message for revision 103739:
  Update checker tests.
  

Changed:
  U   z3c.testsetup/trunk/src/z3c/testsetup/testrunner.txt

-=-
Modified: z3c.testsetup/trunk/src/z3c/testsetup/testrunner.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/testrunner.txt	2009-09-11 14:26:36 UTC (rev 103738)
+++ z3c.testsetup/trunk/src/z3c/testsetup/testrunner.txt	2009-09-11 14:26:53 UTC (rev 103739)
@@ -226,8 +226,8 @@
     False
 
 
-Setting output checker for functional tests
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Setting output checkers for doctests
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Output checkers modify the way, output of tests is recognized. This is
 important for output which can not be foreseen exactly, timestamps for
@@ -250,51 +250,83 @@
         'z3c.testsetup.tests.cave',
         checker = mychecker,
         extensions = ['.chk',],
-        fregexp_list = ['.*checker.*',],
+        regexp_list = ['.*checker.*',],
         )
 
 This setup will find exactly one testfile, the file
 ``checkertest.chk`` in the ``cave`` package, that checks for output of
-the form 'N.NNN seconds', with an arbitrary number of numbers.
+the form 'N.NNN seconds', with an arbitrary number of numbers. The
+doctestfile will serve as both, a usual unit doctest and as a
+functional doctest too.
 
+The doctestfile looks like this:
+
+    >>> content = open(os.path.join(cavepath, 'checkertest.chk'), 'r').read()
+    >>> print '\n'.join(['| ' + x for x in content.split('\n')])
+    | ============
+    | Checker test
+    | ============
+    | 
+    | :Test-Layer: checker
+    |
+    | First we check, whether the <SOME NUMBER OF> term is matched by the
+    | modified checker::
+    | 
+    |   >>> print "%s seconds" % 0.123
+    |   <SOME NUMBER OF> seconds
+    | 
+    | Then we check the <SOME ADDRESS> term::
+    | 
+    |   >>> print "A memory address at 0x1a0322ff"
+    |   A memory address at <SOME ADDRESS>
+    | 
+    | That's it.
+    | 
+
+
 Running the testrunner with this setup will result in::
 
     >>> defaults = [
-    ...     '--path', cavepath, '-f',
+    ...     '--path', cavepath,
     ...     '--tests-pattern', '^samplesetup_short5$',
     ...     ]
     >>> testrunner.run(defaults)
     Running z3c.testsetup....doctesting.FunctionalLayer tests:
       Set up z3c.testsetup....doctesting.FunctionalLayer in N.NNN seconds.
       Ran 2 tests with 0 failures and 0 errors in N.NNN seconds.
-    Tearing down left over layers:
+    Running zope.testing.testrunner.layer.UnitTests tests:
       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.
+      Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
+    Total: 4 tests, 0 failures, 0 errors in N.NNN seconds.
     False
 
 The same setup, but without a modified checker will deliver::
 
     >>> defaults = [
-    ...     '--path', cavepath, '-f',
+    ...     '--path', cavepath,
     ...     '--tests-pattern', '^samplesetup_short6$',
     ...     ]
     >>> testrunner.run(defaults)
-    Running z3c.testsetup....doctesting.FunctionalLayer tests:
-      Set up z3c.testsetup....doctesting.FunctionalLayer in ... seconds.
+    Running z3c.testsetup.functional.doctesting.FunctionalLayer tests:
+      Set up z3c.testsetup...doctesting.FunctionalLayer in ... seconds.
     <BLANKLINE>
     <BLANKLINE>
-    Failure in test ...checkertest.chk
+    Failure in test /.../z3c/testsetup/tests/cave/checkertest.chk
     Failed doctest test for checkertest.chk
-      File "...checkertest.chk", line 0
+      File "/.../z3c/testsetup/tests/cave/checkertest.chk", line 0
     <BLANKLINE>
     ----------------------------------------------------------------------
-    File "...checkertest.chk", line 10, in checkertest.chk
+    File "/.../tests/cave/checkertest.chk", line 10, in checkertest.chk
     Failed example:
         print "%s seconds" % 0.123
     Differences (ndiff with -expected +actual):
         - <SOME NUMBER OF> seconds
         + 0.123 seconds
     ----------------------------------------------------------------------
-    File "...checkertest.chk", line 15, in checkertest.chk
+    File "/.../tests/cave/checkertest.chk", line 15, in checkertest.chk
     Failed example:
         print "A memory address at 0x1a0322ff"
     Differences (ndiff with -expected +actual):
@@ -302,12 +334,38 @@
         + A memory address at 0x1a0322ff
     <BLANKLINE>
       Ran 2 tests with 1 failures and 0 errors in ... seconds.
-    Tearing down left over layers:
-      Tear down z3c.testsetup....doctesting.FunctionalLayer ...
+    Running zope.testing.testrunner.layer.UnitTests tests:
+      Tear down z3c.testsetup...doctesting.FunctionalLayer ... not supported
+      Running in a subprocess.
+      Set up zope.testing.testrunner.layer.UnitTests in ... seconds.
+    <BLANKLINE>
+    <BLANKLINE>
+    Failure in test /.../z3c/testsetup/tests/cave/checkertest.chk
+    Failed doctest test for checkertest.chk
+      File "/.../z3c/testsetup/tests/cave/checkertest.chk", line 0
+    <BLANKLINE>
+    ----------------------------------------------------------------------
+    File "/.../tests/cave/checkertest.chk", line 10, in checkertest.chk
+    Failed example:
+        print "%s seconds" % 0.123
+    Differences (ndiff with -expected +actual):
+        - <SOME NUMBER OF> seconds
+        + 0.123 seconds
+    ----------------------------------------------------------------------
+    File "/.../tests/cave/checkertest.chk", line 15, in checkertest.chk
+    Failed example:
+        print "A memory address at 0x1a0322ff"
+    Differences (ndiff with -expected +actual):
+        - A memory address at <SOME ADDRESS>
+        + A memory address at 0x1a0322ff
+    <BLANKLINE>
+      Ran 2 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.
     True
 
-Note that checkers are currently only supported for functional
-doctests.
+Note that in older versions of `z3c.testsetup` checkers were supported
+for functioanl doctests only.
 
 
 Setting globals for doctests



More information about the checkins mailing list