runner: export pytest.CallInfo for typing purposes

The type cannot be constructed directly, but is exported for use in type
annotations, since it is reachable through existing public API.

This also documents `from_call` as public, because at least
pytest-forked uses it, so we must treat it as public already anyway.
This commit is contained in:
Ran Benita
2020-12-26 21:23:23 +02:00
parent bd76042344
commit 96ea867fec
5 changed files with 52 additions and 23 deletions
+1
View File
@@ -4,5 +4,6 @@ Directly constructing the following classes is now deprecated:
- ``_pytest.mark.structures.MarkDecorator``
- ``_pytest.mark.structures.MarkGenerator``
- ``_pytest.python.Metafunc``
- ``_pytest.runner.CallInfo``
These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0.
+1
View File
@@ -6,6 +6,7 @@ The newly-exported types are:
- ``pytest.MarkDecorator`` for :class:`mark decorators <pytest.MarkDecorator>`.
- ``pytest.MarkGenerator`` for the :class:`pytest.mark <pytest.MarkGenerator>` singleton.
- ``pytest.Metafunc`` for the :class:`metafunc <pytest.MarkGenerator>` argument to the `pytest_generate_tests <pytest.hookspec.pytest_generate_tests>` hook.
- ``pytest.runner.CallInfo`` for the :class:`CallInfo <pytest.CallInfo>` type passed to various hooks.
Constructing them directly is not supported; they are only meant for use in type annotations.
Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0.