Skip to content

Commit 3af525c

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 3af525c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mutmut/__init__.py

Lines changed: 1 addition & 1 deletion
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

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)