File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ Joshua Bronson
151151Jurko Gospodnetić
152152Justyna Janczyszyn
153153Kale Kundert
154+ Kamran Ahmad
154155Karl O. Pinc
155156Katarzyna Jachim
156157Katarzyna Król
Original file line number Diff line number Diff line change @@ -614,6 +614,11 @@ among each other.
614614Declaring new hooks
615615------------------------
616616
617+ .. note ::
618+
619+ This is a quick overview on how to add new hooks and how they work in general, but a more complete
620+ overview can be found in `the pluggy documentation <https://pluggy.readthedocs.io/en/latest/ >`__.
621+
617622.. currentmodule :: _pytest.hookspec
618623
619624Plugins and ``conftest.py `` files may declare new hooks that can then be
@@ -627,7 +632,7 @@ Hooks are usually declared as do-nothing functions that contain only
627632documentation describing when the hook will be called and what return values
628633are expected. The names of the functions must start with `pytest_ ` otherwise pytest won't recognize them.
629634
630- Here's an example. Let's assume this code is in the ``hooks .py `` module.
635+ Here's an example. Let's assume this code is in the ``sample_hook .py `` module.
631636
632637.. code-block :: python
633638
@@ -643,10 +648,10 @@ class or module can then be passed to the ``pluginmanager`` using the ``pytest_a
643648.. code-block :: python
644649
645650 def pytest_addhooks (pluginmanager ):
646- """ This example assumes the hooks are grouped in the 'hooks ' module. """
647- from my_app.tests import hooks
651+ """ This example assumes the hooks are grouped in the 'sample_hook ' module. """
652+ from my_app.tests import sample_hook
648653
649- pluginmanager.add_hookspecs(hooks )
654+ pluginmanager.add_hookspecs(sample_hook )
650655
651656 For a real world example, see `newhooks.py `_ from `xdist <https://github.com/pytest-dev/pytest-xdist >`_.
652657
You can’t perform that action at this time.
0 commit comments