2020-12-20 04:19:51 +08:00
The types of objects used in pytest's API are now exported so they may be used in type annotations.
The newly-exported types are:
- `` pytest.Mark `` for :class: `marks <pytest.Mark>` .
2020-12-20 21:11:01 +08:00
- `` pytest.MarkDecorator `` for :class: `mark decorators <pytest.MarkDecorator>` .
2020-12-20 21:36:24 +08:00
- `` pytest.MarkGenerator `` for the :class: `pytest.mark <pytest.MarkGenerator>` singleton.
2020-12-27 02:49:17 +08:00
- `` pytest.Metafunc `` for the :class: `metafunc <pytest.MarkGenerator>` argument to the `pytest_generate_tests <pytest.hookspec.pytest_generate_tests>` hook.
2020-12-27 03:23:23 +08:00
- `` pytest.runner.CallInfo `` for the :class: `CallInfo <pytest.CallInfo>` type passed to various hooks.
2020-12-20 04:19:51 +08:00
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.
Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy.