diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a22d5f7..13564671 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: - click>=8.4.2 - coverage>=7.3.0 - libcst>=1.9.0 - - pytest>=6.2.5 + - pytest>=7.4.4 - setproctitle>=1.3.7 - textual>=1.0.0 - types-toml>=0.10.2 diff --git a/pyproject.toml b/pyproject.toml index a7809bd9..ca8286f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ dependencies = [ "click>=8.4.2", "coverage>=7.3.0", "libcst>=1.9.0", - "pytest>=6.2.5", + "pytest>=7.4.4", "setproctitle>=1.3.7", "textual>=1.0.0", "toml>=0.10.2 ; python_full_version < '3.11'", @@ -58,7 +58,7 @@ dev = [ "mypy>=2.3.1", "pre-commit>=4.6.2", "pyrefly>=0.59.1", - "pytest-asyncio>=1.0.0", + "pytest-asyncio>=1.4.0", "ruff>=0.16.6", ] diff --git a/src/mutmut/runners/harness.py b/src/mutmut/runners/harness.py index 1381c12d..343c142d 100644 --- a/src/mutmut/runners/harness.py +++ b/src/mutmut/runners/harness.py @@ -3,6 +3,7 @@ from abc import ABC from collections import defaultdict from collections.abc import Iterable +from collections.abc import Sequence from typing import TYPE_CHECKING from typing import Any @@ -14,6 +15,7 @@ from mutmut.utils.format_utils import strip_prefix if TYPE_CHECKING: + import pytest from coverage import Coverage @@ -147,18 +149,18 @@ def _pytest_args_regular_run(self, tests: Iterable[str]) -> list[str]: def run_stats(self, *, tests: Iterable[str]) -> int: class StatsCollector: # noinspection PyMethodMayBeStatic - def pytest_runtest_logstart(self, nodeid: str, location: Any) -> None: + def pytest_runtest_logstart(self, nodeid: str) -> None: state().duration_by_test[nodeid] = 0 # noinspection PyMethodMayBeStatic - def pytest_runtest_teardown(self, item: Any, nextitem: Any) -> None: + def pytest_runtest_teardown(self, item: pytest.Item, nextitem: pytest.Item | None) -> None: unused(nextitem) for function in state()._stats: state().tests_by_mangled_function_name[function].add(strip_prefix(item._nodeid, prefix="mutants/")) state()._stats.clear() # noinspection PyMethodMayBeStatic - def pytest_runtest_makereport(self, item: Any, call: Any) -> None: + def pytest_runtest_makereport(self, item: pytest.Item, call: pytest.CallInfo[None]) -> None: if call.when != "call": return state().duration_by_test[item.nodeid] += call.duration @@ -186,10 +188,10 @@ def __init__(self) -> None: self.collected_nodeids: set[str] = set() self.deselected_nodeids: set[str] = set() - def pytest_collection_modifyitems(self, items: Any) -> None: + def pytest_collection_modifyitems(self, items: list[pytest.Item]) -> None: self.collected_nodeids |= {item.nodeid for item in items} - def pytest_deselected(self, items: Any) -> None: + def pytest_deselected(self, items: Sequence[pytest.Item]) -> None: self.deselected_nodeids |= {item.nodeid for item in items} collector = TestsCollector() diff --git a/uv.lock b/uv.lock index 77581070..c5b3038e 100644 --- a/uv.lock +++ b/uv.lock @@ -513,7 +513,7 @@ requires-dist = [ { name = "click", specifier = ">=8.4.2" }, { name = "coverage", specifier = ">=7.3.0" }, { name = "libcst", specifier = ">=1.9.0" }, - { name = "pytest", specifier = ">=6.2.5" }, + { name = "pytest", specifier = ">=7.4.4" }, { name = "setproctitle", specifier = ">=1.3.7" }, { name = "textual", specifier = ">=1.0.0" }, { name = "toml", marker = "python_full_version < '3.11'", specifier = ">=0.10.2" }, @@ -525,7 +525,7 @@ dev = [ { name = "mypy", specifier = ">=2.3.1" }, { name = "pre-commit", specifier = ">=4.6.2" }, { name = "pyrefly", specifier = ">=0.59.1" }, - { name = "pytest-asyncio", specifier = ">=1.0.0" }, + { name = "pytest-asyncio", specifier = ">=1.4.0" }, { name = "ruff", specifier = ">=0.16.6" }, ] @@ -712,16 +712,16 @@ wheels = [ [[package]] name = "pytest-asyncio" -version = "1.3.0" +version = "1.4.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "backports-asyncio-runner", marker = "python_full_version < '3.11'" }, { name = "pytest" }, { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/90/2c/8af215c0f776415f3590cac4f9086ccefd6fd463befeae41cd4d3f193e5a/pytest_asyncio-1.3.0.tar.gz", hash = "sha256:d7f52f36d231b80ee124cd216ffb19369aa168fc10095013c6b014a34d3ee9e5", size = 50087, upload-time = "2025-11-10T16:07:47.256Z" } +sdist = { url = "https://files.pythonhosted.org/packages/43/7c/d36d04db312ecf4298932ef77e6e4a9e8ad017906e24e34f0b0c361a2473/pytest_asyncio-1.4.0.tar.gz", hash = "sha256:c6c0d2259945122819f171a32ecea2c349ead889ee28176caaf492143424be42", size = 58514, upload-time = "2026-05-26T09:56:04.083Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e5/35/f8b19922b6a25bc0880171a2f1a003eaeb93657475193ab516fd87cac9da/pytest_asyncio-1.3.0-py3-none-any.whl", hash = "sha256:611e26147c7f77640e6d0a92a38ed17c3e9848063698d5c93d5aa7aa11cebff5", size = 15075, upload-time = "2025-11-10T16:07:45.537Z" }, + { url = "https://files.pythonhosted.org/packages/03/e2/08a497ef684b88559c9cc5f4ad53a37e7b99e727094a86d6ea32536d5d3c/pytest_asyncio-1.4.0-py3-none-any.whl", hash = "sha256:933ca923a23075a87fb7070c0ec272a6848489824d887c85c812670932835aa1", size = 16930, upload-time = "2026-05-26T09:56:02.576Z" }, ] [[package]]