improve parametrize() docs
This commit is contained in:
parent
59b8ea1746
commit
50c9e3f654
|
@ -588,22 +588,23 @@ class Metafunc:
|
||||||
self._ids = py.builtin.set()
|
self._ids = py.builtin.set()
|
||||||
|
|
||||||
def parametrize(self, argnames, argvalues, indirect=False, ids=None):
|
def parametrize(self, argnames, argvalues, indirect=False, ids=None):
|
||||||
""" parametrize calls to the underlying test function during
|
""" add new invocations to the underlying test function using the
|
||||||
the collection phase of a test run. parametrize may be called
|
list of argvalues for the given argnames. Parametrization is performed
|
||||||
multiple times for disjunct argnames sets.
|
during the collection phase. If you need to setup expensive resources
|
||||||
|
you may pass indirect=True and implement a funcarg factory which can
|
||||||
|
perform the expensive setup just before a test is actually run.
|
||||||
|
|
||||||
:arg argnames: an argument name or a list of argument names
|
:arg argnames: an argument name or a list of argument names
|
||||||
|
|
||||||
:arg argvalues: a list of values for a single argument if argnames
|
:arg argvalues: a list of values for the argname or a list of tuples of
|
||||||
specified a single argument only or a list of tuples which specify
|
values for the list of argument names.
|
||||||
values for the multiple argument names.
|
|
||||||
|
|
||||||
:arg indirect: if True each argvalue corresponding to an argument will be
|
:arg indirect: if True each argvalue corresponding to an argument will be
|
||||||
passed as request.param to the respective funcarg factory so that
|
passed as request.param to its respective funcarg factory so that
|
||||||
it can perform more expensive setups during the setup phase of
|
it can perform more expensive setups during the setup phase of
|
||||||
a test rather than at collection time (which is the default).
|
a test rather than at collection time.
|
||||||
|
|
||||||
:arg ids: list of string ids corresponding to the (list of) argvalues
|
:arg ids: list of string ids each corresponding to the argvalues
|
||||||
so that they are part of the test id. If no ids are provided
|
so that they are part of the test id. If no ids are provided
|
||||||
they will be generated automatically from the argvalues.
|
they will be generated automatically from the argvalues.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -240,5 +240,5 @@ in the class or module where a test function is defined:
|
||||||
|
|
||||||
``metafunc.config``: access to command line opts and general config
|
``metafunc.config``: access to command line opts and general config
|
||||||
|
|
||||||
.. automethod:: Metafunc.parametrize(name, values, idmaker=None)
|
.. automethod:: Metafunc.parametrize
|
||||||
.. automethod:: Metafunc.addcall(funcargs=None, id=_notexists, param=_notexists)
|
.. automethod:: Metafunc.addcall(funcargs=None,id=_notexists,param=_notexists)
|
||||||
|
|
Loading…
Reference in New Issue