File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,8 +148,8 @@ functions with :data:`~typing.Any`.
148148Using the pytest plugin
149149-----------------------
150150
151- Typeguard comes with a pytest plugin that installs the import hook (explained in the
152- previous section). To use it, run ``pytest `` with the appropriate
151+ Typeguard comes with a plugin for pytest (v7.0 or newer) that installs the import hook
152+ (explained in the previous section). To use it, run ``pytest `` with the appropriate
153153``--typeguard-packages `` option. For example, if you wanted to instrument the
154154``foo.bar `` and ``xyz `` packages for type checking, you can do the following:
155155
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ This library adheres to
1111 (`#460 <https://github.com/agronholm/typeguard/issues/460 >`_; PR by @JelleZijlstra)
1212- Fixed test suite incompatibility with pytest 8.2
1313 (`#461 <https://github.com/agronholm/typeguard/issues/461 >`_)
14+ - Fixed pytest plugin crashing on pytest version older than v7.0.0 (even if it's just
15+ present) (`#343 <https://github.com/agronholm/typeguard/issues/343 >`_)
1416
1517**4.2.1 ** (2023-03-24)
1618
Original file line number Diff line number Diff line change 22
33import sys
44import warnings
5- from typing import Any , Literal
6-
7- from pytest import Config , Parser
5+ from typing import TYPE_CHECKING , Any , Literal
86
97from typeguard ._config import CollectionCheckStrategy , ForwardRefPolicy , global_config
108from typeguard ._exceptions import InstrumentationWarning
119from typeguard ._importhook import install_import_hook
1210from typeguard ._utils import qualified_name , resolve_reference
1311
12+ if TYPE_CHECKING :
13+ from pytest import Config , Parser
14+
1415
1516def pytest_addoption (parser : Parser ) -> None :
1617 def add_ini_option (
You can’t perform that action at this time.
0 commit comments