Skip to content

Commit a6708b9

Browse files
authored
Merge pull request #11822 from bluetech/doc-hookspec
hookspec: minor doc tweaks
2 parents e895c9d + c973ccb commit a6708b9

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/_pytest/hookspec.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def pytest_addhooks(pluginmanager: "PytestPluginManager") -> None:
5454
"""Called at plugin registration time to allow adding new hooks via a call to
5555
:func:`pluginmanager.add_hookspecs(module_or_class, prefix) <pytest.PytestPluginManager.add_hookspecs>`.
5656
57-
:param pytest.PytestPluginManager pluginmanager: The pytest plugin manager.
57+
:param pluginmanager: The pytest plugin manager.
5858
5959
.. note::
6060
This hook is incompatible with hook wrappers.
@@ -68,7 +68,7 @@ def pytest_plugin_registered(
6868
"""A new pytest plugin got registered.
6969
7070
:param plugin: The plugin module or instance.
71-
:param pytest.PytestPluginManager manager: pytest plugin manager.
71+
:param manager: pytest plugin manager.
7272
7373
.. note::
7474
This hook is incompatible with hook wrappers.
@@ -86,13 +86,13 @@ def pytest_addoption(parser: "Parser", pluginmanager: "PytestPluginManager") ->
8686
files situated at the tests root directory due to how pytest
8787
:ref:`discovers plugins during startup <pluginorder>`.
8888
89-
:param pytest.Parser parser:
89+
:param parser:
9090
To add command line options, call
9191
:py:func:`parser.addoption(...) <pytest.Parser.addoption>`.
9292
To add ini-file values call :py:func:`parser.addini(...)
9393
<pytest.Parser.addini>`.
9494
95-
:param pytest.PytestPluginManager pluginmanager:
95+
:param pluginmanager:
9696
The pytest plugin manager, which can be used to install :py:func:`~pytest.hookspec`'s
9797
or :py:func:`~pytest.hookimpl`'s and allow one plugin to call another plugin's hooks
9898
to change how command line options are added.
@@ -127,7 +127,7 @@ def pytest_configure(config: "Config") -> None:
127127
.. note::
128128
This hook is incompatible with hook wrappers.
129129
130-
:param pytest.Config config: The pytest config object.
130+
:param config: The pytest config object.
131131
"""
132132

133133

@@ -156,18 +156,6 @@ def pytest_cmdline_parse(
156156
"""
157157

158158

159-
@hookspec(firstresult=True)
160-
def pytest_cmdline_main(config: "Config") -> Optional[Union["ExitCode", int]]:
161-
"""Called for performing the main command line action. The default
162-
implementation will invoke the configure hooks and runtest_mainloop.
163-
164-
Stops at first non-None result, see :ref:`firstresult`.
165-
166-
:param config: The pytest config object.
167-
:returns: The exit code.
168-
"""
169-
170-
171159
def pytest_load_initial_conftests(
172160
early_config: "Config", parser: "Parser", args: List[str]
173161
) -> None:
@@ -183,6 +171,20 @@ def pytest_load_initial_conftests(
183171
"""
184172

185173

174+
@hookspec(firstresult=True)
175+
def pytest_cmdline_main(config: "Config") -> Optional[Union["ExitCode", int]]:
176+
"""Called for performing the main command line action.
177+
178+
The default implementation will invoke the configure hooks and
179+
:hook:`pytest_runtestloop`.
180+
181+
Stops at first non-None result, see :ref:`firstresult`.
182+
183+
:param config: The pytest config object.
184+
:returns: The exit code.
185+
"""
186+
187+
186188
# -------------------------------------------------------------------------
187189
# collection hooks
188190
# -------------------------------------------------------------------------
@@ -435,7 +437,7 @@ def pytest_make_parametrize_id(
435437
436438
:param config: The pytest config object.
437439
:param val: The parametrized value.
438-
:param str argname: The automatic parameter name produced by pytest.
440+
:param argname: The automatic parameter name produced by pytest.
439441
"""
440442

441443

0 commit comments

Comments
 (0)