[Checkins]
SVN: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/
First test for shortform syntax.
Uli Fouquet
uli at gnufix.de
Sat Feb 2 05:21:59 EST 2008
Log message for revision 83402:
First test for shortform syntax.
Changed:
A Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/samplesetup_short2.py
U Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/testrunner.txt
-=-
Added: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/samplesetup_short2.py
===================================================================
--- Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/samplesetup_short2.py (rev 0)
+++ Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/samplesetup_short2.py 2008-02-02 10:21:58 UTC (rev 83402)
@@ -0,0 +1,4 @@
+import z3c.testsetup
+from z3c.testsetup.tests import cave
+
+test_suite = z3c.testsetup.register_doctests(cave)
Modified: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/testrunner.txt
===================================================================
--- Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/testrunner.txt 2008-02-02 09:23:46 UTC (rev 83401)
+++ Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/testrunner.txt 2008-02-02 10:21:58 UTC (rev 83402)
@@ -6,11 +6,47 @@
in this directory. We will run the `zope.testing.testrunner` and
examine their output.
+Short setups
+------------
+
+ >>> import os
+ >>> cavepath = os.path.join(os.path.dirname(__file__), 'cave')
+ >>> setupfile = os.path.join(cavepath, 'samplesetup_short2.py')
+ >>> print open(setupfile).read()
+ import z3c.testsetup
+ from z3c.testsetup.tests import cave
+ <BLANKLINE>
+ test_suite = z3c.testsetup.register_doctests(cave)
+ <BLANKLINE>
+
+Here we register all doctests from the ``cave`` module. Let's start a
+testrunner with this setup::
+
+ >>> import sys
+ >>> defaults = [
+ ... '--path', cavepath,
+ ... '--tests-pattern', '^samplesetup_short2$',
+ ... ]
+ >>> sys.argv = 'test '.split()
+ >>> from zope.testing import testrunner
+ >>> testrunner.run(defaults)
+ Running unit tests:
+ Ran 1 tests with 0 failures and 0 errors in ... seconds.
+ Running z3c.testsetup.testing.FunctionalLayer tests:
+ Set up z3c.testsetup.testing.FunctionalLayer in ... seconds.
+ Ran 2 tests with 0 failures and 0 errors in ... seconds.
+ Tearing down left over layers:
+ Tear down z3c.testsetup.testing.FunctionalLayer ... not supported
+ Total: 3 tests, 0 failures, 0 errors in ... seconds.
+ False
+
+
+Extended setups
+---------------
+
Let's have a look at the test setup module `samplesetup1` in the
`cave` package::
- >>> import os
- >>> cavepath = os.path.join(os.path.dirname(__file__), 'cave')
>>> setupfile = os.path.join(cavepath, 'samplesetup1.py')
>>> print open(setupfile).read()
import unittest
@@ -38,10 +74,9 @@
configured such, that all files named 'samplesetup1.py' will be asked
to return a testsuite::
- >>> import os.path, sys
- >>> directory_with_tests = os.path.join(this_directory, 'cave')
+ >>> import sys
>>> defaults = [
- ... '--path', directory_with_tests,
+ ... '--path', cavepath,
... '--tests-pattern', '^samplesetup1$',
... ]
>>> sys.argv = 'test '.split()
More information about the Checkins
mailing list