diff --git a/src/pytest_codspeed/plugin.py b/src/pytest_codspeed/plugin.py index 24e0401..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[..., T], *args: tuple, **kwargs: dict[str, Any] - ) -> 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