Skip to content

Improved 'Declaring new hooks' section in docs. #7782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Joshua Bronson
Jurko Gospodnetić
Justyna Janczyszyn
Kale Kundert
Kamran Ahmad
Karl O. Pinc
Katarzyna Jachim
Katarzyna Król
Expand Down
6 changes: 3 additions & 3 deletions doc/en/writing_plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ Hooks are usually declared as do-nothing functions that contain only
documentation describing when the hook will be called and what return values
are expected. The names of the functions must start with `pytest_` otherwise pytest won't recognize them.

Here's an example. Let's assume this code is in the ``hooks.py`` module.
Here's an example. Let's assume this code is in the ``sample_hook.py`` module.

.. code-block:: python

Expand All @@ -643,8 +643,8 @@ class or module can then be passed to the ``pluginmanager`` using the ``pytest_a
.. code-block:: python

def pytest_addhooks(pluginmanager):
""" This example assumes the hooks are grouped in the 'hooks' module. """
from my_app.tests import hooks
""" This example assumes the hooks are grouped in the 'sample_hook' module. """
from my_app.tests import sample_hook

pluginmanager.add_hookspecs(hooks)

Expand Down