Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
Expand Down Expand Up @@ -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",
]

Expand Down
12 changes: 7 additions & 5 deletions src/mutmut/runners/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -14,6 +15,7 @@
from mutmut.utils.format_utils import strip_prefix

if TYPE_CHECKING:
import pytest
from coverage import Coverage


Expand Down Expand Up @@ -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:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: location value not use.
What do i do about this: delete location value (like I did now) or add unused(location) like https://github.com/boxed/mutmut/pull/588/changes#diff-86317b552b7ee85b5f8e8914061c9f15cf0418066241955c111f8fc1cf64ff5cR156 ?

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
Expand Down Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading