Merge pull request #7979 from nicoddemus/metafunc-ref
Add FunctionDefinition to the reference docs
This commit is contained in:
parent
1ed903e8fc
commit
0dca7ee21a
|
@ -816,6 +816,13 @@ Function
|
||||||
:members:
|
:members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
|
FunctionDefinition
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. autoclass:: _pytest.python.FunctionDefinition()
|
||||||
|
:members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
Item
|
Item
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
|
|
|
@ -943,6 +943,7 @@ class Metafunc:
|
||||||
cls=None,
|
cls=None,
|
||||||
module=None,
|
module=None,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
#: Access to the underlying :class:`_pytest.python.FunctionDefinition`.
|
||||||
self.definition = definition
|
self.definition = definition
|
||||||
|
|
||||||
#: Access to the :class:`_pytest.config.Config` object for the test session.
|
#: Access to the :class:`_pytest.config.Config` object for the test session.
|
||||||
|
@ -1664,10 +1665,12 @@ class Function(PyobjMixin, nodes.Item):
|
||||||
|
|
||||||
|
|
||||||
class FunctionDefinition(Function):
|
class FunctionDefinition(Function):
|
||||||
"""Internal hack until we get actual definition nodes instead of the
|
"""
|
||||||
crappy metafunc hack."""
|
This class is a step gap solution until we evolve to have actual function definition nodes
|
||||||
|
and manage to get rid of ``metafunc``.
|
||||||
|
"""
|
||||||
|
|
||||||
def runtest(self) -> None:
|
def runtest(self) -> None:
|
||||||
raise RuntimeError("function definitions are not supposed to be used")
|
raise RuntimeError("function definitions are not supposed to be run as tests")
|
||||||
|
|
||||||
setup = runtest
|
setup = runtest
|
||||||
|
|
Loading…
Reference in New Issue