File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -148,8 +148,8 @@ functions with :data:`~typing.Any`.
148
148
Using the pytest plugin
149
149
-----------------------
150
150
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
153
153
``--typeguard-packages `` option. For example, if you wanted to instrument the
154
154
``foo.bar `` and ``xyz `` packages for type checking, you can do the following:
155
155
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ This library adheres to
11
11
(`#460 <https://github.com/agronholm/typeguard/issues/460 >`_; PR by @JelleZijlstra)
12
12
- Fixed test suite incompatibility with pytest 8.2
13
13
(`#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 >`_)
14
16
15
17
**4.2.1 ** (2023-03-24)
16
18
Original file line number Diff line number Diff line change 2
2
3
3
import sys
4
4
import warnings
5
- from typing import Any , Literal
6
-
7
- from pytest import Config , Parser
5
+ from typing import TYPE_CHECKING , Any , Literal
8
6
9
7
from typeguard ._config import CollectionCheckStrategy , ForwardRefPolicy , global_config
10
8
from typeguard ._exceptions import InstrumentationWarning
11
9
from typeguard ._importhook import install_import_hook
12
10
from typeguard ._utils import qualified_name , resolve_reference
13
11
12
+ if TYPE_CHECKING :
13
+ from pytest import Config , Parser
14
+
14
15
15
16
def pytest_addoption (parser : Parser ) -> None :
16
17
def add_ini_option (
You can’t perform that action at this time.
0 commit comments