You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Export `HookRecorder`, `RecordedHookCall` (originally `ParsedCall`),
`RunResult`, `LineMatcher`.
These types are reachable through `Pytester` and so should be public
themselves for typing and other purposes.
The name `ParsedCall` I think is too generic under the `pytest`
namespace, so rename it to `RecordedHookCall`.
The `HookRecorder`'s constructor is made private -- it should only be
constructed by `Pytester`.
`LineMatcher` and `RunResult` are exported as is - no private and no
rename, since they're being used.
All of the classes are made final as they are not designed for
subclassing.
Copy file name to clipboardExpand all lines: changelog/7469.feature.rst
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,12 @@ The newly-exported types are:
12
12
- ``pytest.ExceptionInfo`` for the :class:`ExceptionInfo <pytest.ExceptionInfo>` type returned from :func:`pytest.raises` and passed to various hooks.
13
13
- ``pytest.Parser`` for the :class:`Parser <pytest.Parser>` type passed to the :func:`pytest_addoption <pytest.hookspec.pytest_addoption>` hook.
14
14
- ``pytest.OptionGroup`` for the :class:`OptionGroup <pytest.OptionGroup>` type returned from the :func:`parser.addgroup <pytest.Parser.getgroup>` method.
15
+
- ``pytest.HookRecorder`` for the :class:`HookRecorder <pytest.HookRecorder>` type returned from :class:`~pytest.Pytester`.
16
+
- ``pytest.RecordedHookCall`` for the :class:`RecordedHookCall <pytest.HookRecorder>` type returned from :class:`~pytest.HookRecorder`.
17
+
- ``pytest.RunResult`` for the :class:`RunResult <pytest.RunResult>` type returned from :class:`~pytest.Pytester`.
18
+
- ``pytest.LineMatcher`` for the :class:`LineMatcher <pytest.RunResult>` type used in :class:`~pytest.RunResult` and others.
15
19
16
-
Constructing them directly is not supported; they are only meant for use in type annotations.
20
+
Constructing most of them directly is not supported; they are only meant for use in type annotations.
17
21
Doing so will emit a deprecation warning, and may become a hard-error in pytest 8.0.
18
22
19
23
Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy.
0 commit comments