From b0997332b50062533e03e78c293f22e892eb37ee Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Thu, 10 Jul 2025 22:31:16 +0200 Subject: [PATCH 1/2] Fix some of the typing broken in #81 --- src/pytest_codspeed/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pytest_codspeed/plugin.py b/src/pytest_codspeed/plugin.py index 24e0401..a43d07d 100644 --- a/src/pytest_codspeed/plugin.py +++ b/src/pytest_codspeed/plugin.py @@ -329,7 +329,7 @@ def __init__(self, request: pytest.FixtureRequest): self._called = False def __call__( - self, target: Callable[..., T], *args: tuple, **kwargs: dict[str, Any] + self, target: Callable[P, T], *args: P.args, **kwargs: P.kwargs ) -> T: if self._called: raise RuntimeError("The benchmark fixture can only be used once per test") From fc4e319a8d8c46295d004f07d005d53a6c2ffec4 Mon Sep 17 00:00:00 2001 From: Phil Schaf Date: Thu, 24 Jul 2025 14:43:50 +0200 Subject: [PATCH 2/2] fix imports --- src/pytest_codspeed/plugin.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pytest_codspeed/plugin.py b/src/pytest_codspeed/plugin.py index a43d07d..ef128da 100644 --- a/src/pytest_codspeed/plugin.py +++ b/src/pytest_codspeed/plugin.py @@ -30,11 +30,12 @@ from . import __version__ if TYPE_CHECKING: - from typing import Any, Callable, TypeVar + from typing import Any, Callable, ParamSpec, TypeVar from pytest_codspeed.instruments import Instrument T = TypeVar("T") + P = ParamSpec("P") @pytest.hookimpl(trylast=True) @@ -328,9 +329,7 @@ def __init__(self, request: pytest.FixtureRequest): self._plugin = get_plugin(self._config) self._called = False - def __call__( - self, target: Callable[P, T], *args: P.args, **kwargs: P.kwargs - ) -> T: + def __call__(self, target: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> T: if self._called: raise RuntimeError("The benchmark fixture can only be used once per test") self._called = True