[Checkins] SVN: z3c.testsetup/branches/new_markers/src/z3c/testsetup/tests/othercave/ Make something more interesting in custom sample setup/teardown.
Uli Fouquet
uli at gnufix.de
Tue Jan 6 15:08:22 EST 2009
Log message for revision 94550:
Make something more interesting in custom sample setup/teardown.
Changed:
U z3c.testsetup/branches/new_markers/src/z3c/testsetup/tests/othercave/doctest05.txt
U z3c.testsetup/branches/new_markers/src/z3c/testsetup/tests/othercave/testing.py
-=-
Modified: z3c.testsetup/branches/new_markers/src/z3c/testsetup/tests/othercave/doctest05.txt
===================================================================
--- z3c.testsetup/branches/new_markers/src/z3c/testsetup/tests/othercave/doctest05.txt 2009-01-06 19:32:26 UTC (rev 94549)
+++ z3c.testsetup/branches/new_markers/src/z3c/testsetup/tests/othercave/doctest05.txt 2009-01-06 20:08:21 UTC (rev 94550)
@@ -7,3 +7,8 @@
>>> 1+1
2
+
+We make use of a function registered during custom setup::
+
+ >>> myfunc(2)
+ 4
Modified: z3c.testsetup/branches/new_markers/src/z3c/testsetup/tests/othercave/testing.py
===================================================================
--- z3c.testsetup/branches/new_markers/src/z3c/testsetup/tests/othercave/testing.py 2009-01-06 19:32:26 UTC (rev 94549)
+++ z3c.testsetup/branches/new_markers/src/z3c/testsetup/tests/othercave/testing.py 2009-01-06 20:08:21 UTC (rev 94550)
@@ -3,10 +3,13 @@
def setUp(test):
print " Custom setUp for ", test
+ # We register a function that will be available during tests.
+ test.globs['myfunc'] = lambda x: 2*x
def tearDown(test):
print " Custom tearDown for ", test
-
+ del test.globs['myfunc'] # unregister function
+
# We define a ZCML test layer. ZCML layers are special as they define
# some setup code for creation of empty ZODBs and more. If you only
# want some ZCML registrations to be done, you can use it like so:
More information about the Checkins
mailing list