resolves issue 25
fix documentation for cached_setup, thanks to anonymous for reporting. --HG-- branch : 1.0.x
This commit is contained in:
parent
64a5075545
commit
60a7556ca3
|
@ -136,12 +136,12 @@ managing fixtures across test modules and test runs
|
|||
|
||||
.. sourcecode:: python
|
||||
|
||||
def cached_setup(setup, teardown=None, scope="module", keyextra=None):
|
||||
def cached_setup(setup, teardown=None, scope="module", extrakey=None):
|
||||
""" cache and return result of calling setup().
|
||||
|
||||
The scope determines the cache key and ``keyextra`` adds to the cachekey.
|
||||
The scope also determines when teardown(result) will be called.
|
||||
valid scopes:
|
||||
The scope and the ``extrakey`` determine the cache key.
|
||||
The scope also determines when teardown(result)
|
||||
will be called. valid scopes are:
|
||||
scope == 'function': when the single test function run finishes.
|
||||
scope == 'module': when tests in a different module are run
|
||||
scope == 'session': when tests of the session have run.
|
||||
|
|
|
@ -103,6 +103,15 @@ class FuncargRequest:
|
|||
self._pyfuncitem.funcargs[argname] = self.getfuncargvalue(argname)
|
||||
|
||||
def cached_setup(self, setup, teardown=None, scope="module", extrakey=None):
|
||||
""" cache and return result of calling setup().
|
||||
|
||||
The scope and the ``extrakey`` determine the cache key.
|
||||
The scope also determines when teardown(result)
|
||||
will be called. valid scopes are:
|
||||
scope == 'function': when the single test function run finishes.
|
||||
scope == 'module': when tests in a different module are run
|
||||
scope == 'session': when tests of the session have run.
|
||||
"""
|
||||
if not hasattr(self.config, '_setupcache'):
|
||||
self.config._setupcache = {} # XXX weakref?
|
||||
cachekey = (self._getscopeitem(scope), extrakey)
|
||||
|
|
Loading…
Reference in New Issue