Skip to content

Commit e507275

Browse files
hoeflingnicoddemus
authored andcommitted
docs: use correct qualname for _Result class, correct intersphinx mapping, mark exceptions as such
Signed-off-by: oleg.hoefling <[email protected]>
1 parent 758941c commit e507275

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Features
5151

5252
- `#260 <https://github.com/pytest-dev/pluggy/issues/260>`_: Added "new-style" hook wrappers, a simpler but equally powerful alternative to the existing ``hookwrapper=True`` wrappers.
5353

54-
New-style wrappers are generator functions, similarly to ``hookwrapper``, but do away with the :class:`result <pluggy._callers._Result>` object.
54+
New-style wrappers are generator functions, similarly to ``hookwrapper``, but do away with the :class:`result <pluggy._result._Result>` object.
5555
Instead, the return value is sent directly to the ``yield`` statement, or, if inner calls raised an exception, it is raised from the ``yield``.
5656
The wrapper is expected to return a value or raise an exception, which will become the result of the hook call.
5757

@@ -64,7 +64,7 @@ Features
6464
- `#364 <https://github.com/pytest-dev/pluggy/issues/364>`_: Python 3.11 and 3.12 are now officially supported.
6565

6666

67-
- `#394 <https://github.com/pytest-dev/pluggy/issues/394>`_: Added the :meth:`~pluggy._callers._Result.force_exception` method to ``_Result``.
67+
- `#394 <https://github.com/pytest-dev/pluggy/issues/394>`_: Added the :meth:`~pluggy._result._Result.force_exception` method to ``_Result``.
6868

6969
``force_exception`` allows (old-style) hookwrappers to force an exception or override/adjust an existing exception of a hook invocation,
7070
in a properly behaving manner. Using ``force_exception`` is preferred over raising an exception from the hookwrapper,

docs/api_reference.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ API Reference
77
:members:
88
:undoc-members:
99

10-
.. autoclass:: pluggy._callers._Result
11-
.. automethod:: pluggy._callers._Result.get_result
12-
.. automethod:: pluggy._callers._Result.force_result
13-
.. automethod:: pluggy._callers._Result.force_exception
10+
.. autoclass:: pluggy._result._Result
11+
.. automethod:: pluggy._result._Result.get_result
12+
.. automethod:: pluggy._result._Result.force_result
13+
.. automethod:: pluggy._result._Result.force_exception
1414

1515
.. autoclass:: pluggy._hooks._HookCaller
1616
.. automethod:: pluggy._hooks._HookCaller.call_extra

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@
8686
intersphinx_mapping = {
8787
"python": ("https://docs.python.org/3", None),
8888
"pytest": ("https://docs.pytest.org/en/latest", None),
89-
"setuptools": ("https://setuptools.readthedocs.io/en/latest", None),
90-
"tox": ("https://tox.readthedocs.io/en/latest", None),
89+
"setuptools": ("https://setuptools.pypa.io/en/latest", None),
90+
"tox": ("https://tox.wiki/en/latest", None),
9191
"devpi": ("https://devpi.net/docs/devpi/devpi/stable/+doc/", None),
92-
"kedro": ("https://kedro.readthedocs.io/en/latest/", None),
92+
"kedro": ("https://docs.kedro.org/en/latest/", None),
9393
}
9494

9595

docs/index.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -468,21 +468,21 @@ execution of all corresponding non-wrappper *hookimpls*.
468468
if config.use_defaults:
469469
outcome.force_result(defaults)
470470
471-
The generator is :py:meth:`sent <python:generator.send>` a :py:class:`pluggy._callers._Result` object which can
471+
The generator is :py:meth:`sent <python:generator.send>` a :py:class:`pluggy._result._Result` object which can
472472
be assigned in the ``yield`` expression and used to inspect
473473
the final result(s) or exceptions returned back to the caller using the
474-
:py:meth:`~pluggy._callers._Result.get_result` method, override the result
475-
using the :py:meth:`~pluggy._callers._Result.force_result`, or override
476-
the exception using the :py:meth:`~pluggy._callers._Result.force_exception`
474+
:py:meth:`~pluggy._result._Result.get_result` method, override the result
475+
using the :py:meth:`~pluggy._result._Result.force_result`, or override
476+
the exception using the :py:meth:`~pluggy._result._Result.force_exception`
477477
method.
478478

479479
.. note::
480480
Old-style hook wrappers can **not** return results; they can only modify
481-
them using the :py:meth:`~pluggy._callers._Result.force_result` API.
481+
them using the :py:meth:`~pluggy._result._Result.force_result` API.
482482

483483
Old-style Hook wrappers should **not** raise exceptions; this will cause
484484
further hookwrappers to be skipped. They should use
485-
:py:meth:`~pluggy._callers._Result.force_exception` to adjust the
485+
:py:meth:`~pluggy._result._Result.force_exception` to adjust the
486486
exception.
487487

488488
.. _specs:

src/pluggy/_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def register(self, plugin: _Plugin, name: str | None = None) -> str | None:
119119
120120
If the name is blocked from registering, returns ``None``.
121121
122-
If the plugin is already registered, raises a :class:`ValueError`.
122+
If the plugin is already registered, raises a :exc:`ValueError`.
123123
"""
124124
plugin_name = name or self.get_canonical_name(plugin)
125125

@@ -329,7 +329,7 @@ def _verify_hook(self, hook: _HookCaller, hookimpl: HookImpl) -> None:
329329
def check_pending(self) -> None:
330330
"""Verify that all hooks which have not been verified against a
331331
hook specification are optional, otherwise raise
332-
:class:`PluginValidationError`."""
332+
:exc:`PluginValidationError`."""
333333
for name in self.hook.__dict__:
334334
if name[0] != "_":
335335
hook: _HookCaller = getattr(self.hook, name)
@@ -399,7 +399,7 @@ def add_hookcall_monitoring(
399399
of HookImpl instances and the keyword arguments for the hook call.
400400
401401
``after(outcome, hook_name, hook_impls, kwargs)`` receives the
402-
same arguments as ``before`` but also a :class:`_Result` object
402+
same arguments as ``before`` but also a :class:`~pluggy._result._Result` object
403403
which represents the result of the overall hook call.
404404
"""
405405
oldcall = self._inner_hookexec

0 commit comments

Comments
 (0)