From 59ea7ad0db3af9e0edee4630cd01b99352afaaa3 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Wed, 14 Feb 2024 08:04:39 -0600 Subject: [PATCH] Move type annotations to TYPE_CHECKING --- src/pytest_codspeed/plugin.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pytest_codspeed/plugin.py b/src/pytest_codspeed/plugin.py index 7eae05a..11e4b84 100644 --- a/src/pytest_codspeed/plugin.py +++ b/src/pytest_codspeed/plugin.py @@ -6,7 +6,7 @@ import pkgutil import sys from dataclasses import dataclass, field -from typing import TYPE_CHECKING, ParamSpec, TypeVar +from typing import TYPE_CHECKING import pytest from _pytest.fixtures import FixtureManager @@ -17,10 +17,13 @@ from ._wrapper import get_lib if TYPE_CHECKING: - from typing import Any, Callable, Iterator + from typing import Any, Callable, Iterator, ParamSpec, TypeVar from ._wrapper import LibType + T = TypeVar("T") + P = ParamSpec("P") + IS_PYTEST_BENCHMARK_INSTALLED = pkgutil.find_loader("pytest_benchmark") is not None SUPPORTS_PERF_TRAMPOLINE = sys.version_info >= (3, 12) @@ -165,10 +168,6 @@ def pytest_collection_modifyitems( items[:] = selected -T = TypeVar("T") -P = ParamSpec("P") - - def wrap_pyfunc_with_instrumentation( lib: LibType, nodeid: str,