* create funcarg Request object only once per function run setup

* add getfuncargvalue() for retrieving arbitrary funcargs from a provider

--HG--
branch : trunk
This commit is contained in:
holger krekel
2009-05-21 09:45:43 +02:00
parent d1f24aa251
commit dcee9bdd6e
5 changed files with 117 additions and 48 deletions
+16 -2
View File
@@ -108,8 +108,6 @@ encapsulate a request for a function argument for a
specific test function. Request objects allow providers
to access test configuration and test context:
``request.argname``: name of the requested function argument
``request.function``: python function object requesting the argument
``request.cls``: class object where the test function is defined in or None.
@@ -120,6 +118,7 @@ to access test configuration and test context:
``request.param``: if exists was passed by a `parametrizing test generator`_
perform scoped setup and teardown
---------------------------------------------
@@ -171,6 +170,21 @@ object that is to be closed when the test function finishes.
request.addfinalizer(lambda: myfile.close())
return myfile
requesting values of other funcargs
---------------------------------------------
While setting up one function argument you may
want to retrieve another function argument.
.. sourcecode:: python
def getfuncargvalue(name):
""" Lookup and call function argument provider for the given name.
Each function argument is only requested once per function setup.
"""
Note that it does not matter if the test function
specifies the requested function argument.
decorating other funcarg providers
++++++++++++++++++++++++++++++++++++++++