Skip to content

Commit 1570271

Browse files
committed
fix(reduce): always report other results
Previously aborting the replay would cause other results to be lost
1 parent f11d2a9 commit 1570271

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/grizzly/reduce/core.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
from __future__ import annotations
77

8-
import os
98
from itertools import chain
109
from logging import getLogger
1110
from math import ceil, log
11+
from os import linesep
1212
from pathlib import Path
1313
from time import time
1414
from typing import TYPE_CHECKING
@@ -651,20 +651,18 @@ def run(
651651
# otherwise, ensure the first found signature is used throughout
652652
self._signature = replay.signature
653653

654-
if best_results:
655-
self.report(best_results, self.testcases, update_status=True)
656-
for result, reduction in other_results.values():
657-
self.report([result], reduction)
658-
659654
except KeyboardInterrupt:
660655
if best_results:
661-
self.report(best_results, self.testcases, update_status=True)
662656
LOG.warning(
663657
"Ctrl+C detected, best reduction so far reported as %r",
664658
self._status.last_reports,
665659
)
666660
raise
667661
finally:
662+
if best_results:
663+
self.report(best_results, self.testcases, update_status=True)
664+
for result, reduction in other_results.values():
665+
self.report([result], reduction)
668666
for result in best_results:
669667
result.report.cleanup()
670668
for result, reduction in other_results.values():
@@ -696,7 +694,7 @@ def run(
696694
# log a summary of what was done.
697695
LOG.info(
698696
"Reduction summary:%s%s",
699-
os.linesep,
697+
linesep,
700698
ReductionStatusReporter([self._status]).summary(),
701699
)
702700
self._status.report(force=True)

0 commit comments

Comments
 (0)