doc: document pytest.{hookspec,hookimpl} in the API Reference

Makes sense for them to be there; also allows for Sphinx refs.
This commit is contained in:
Ran Benita
2023-12-06 23:58:07 +02:00
parent cd269f0e6d
commit a5ee9f2ecd
2 changed files with 23 additions and 6 deletions

View File

@@ -612,10 +612,30 @@ Hooks
**Tutorial**: :ref:`writing-plugins`
.. currentmodule:: _pytest.hookspec
Reference to all hooks which can be implemented by :ref:`conftest.py files <localplugin>` and :ref:`plugins <plugins>`.
@pytest.hookimpl
~~~~~~~~~~~~~~~~
.. function:: pytest.hookimpl
:decorator:
pytest's decorator for marking functions as hook implementations.
See :ref:`writinghooks` and :func:`pluggy.HookimplMarker`.
@pytest.hookspec
~~~~~~~~~~~~~~~~
.. function:: pytest.hookspec
:decorator:
pytest's decorator for marking functions as hook specifications.
See :ref:`declaringhooks` and :func:`pluggy.HookspecMarker`.
.. currentmodule:: _pytest.hookspec
Bootstrapping hooks
~~~~~~~~~~~~~~~~~~~