Skip to content

Commit 5ab6b77

Browse files
Adjust duration_by_test definition to reflect new use
As at the status quo, whichever call item ran last (usually 'teardown') had its time overwrite the test in question's entry in duration_by_test. The simplest way I could think of to avoid that was to add each call item's duration to the total in duration_by_test. Changing duration_by_test to a defaultdict simplified the bookkeeping.
1 parent e33f6f7 commit 5ab6b77

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mutmut/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
__version__ = '3.3.1'
44

55

6-
duration_by_test = {}
6+
duration_by_test = defaultdict(float)
77
stats_time = None
88
config = None
99

@@ -14,7 +14,7 @@
1414
def _reset_globals():
1515
global duration_by_test, stats_time, config, _stats, tests_by_mangled_function_name
1616

17-
duration_by_test = {}
17+
duration_by_test.clear()
1818
stats_time = None
1919
config = None
2020
_stats = set()

mutmut/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def pytest_runtest_teardown(self, item, nextitem):
426426

427427
# noinspection PyMethodMayBeStatic
428428
def pytest_runtest_makereport(self, item, call):
429-
mutmut.duration_by_test[item.nodeid] = call.duration
429+
mutmut.duration_by_test[item.nodeid] += call.duration
430430

431431
stats_collector = StatsCollector()
432432

0 commit comments

Comments
 (0)