Skip to content

Commit

Permalink
Avoid a divide by zero in status reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
tysmith committed Sep 12, 2024
1 parent 018c276 commit 2dcae32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion grizzly/common/status_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ def specific(
body.append(str(timedelta(seconds=int(entry.total))))
else:
body.append(f"{entry.total:0.3f}s")
body.append(f" {entry.total / report.runtime * 100:0.2f}%")
if report.runtime > 0:
body.append(f" {entry.total / report.runtime * 100:0.2f}%")
body.append(f" ({avg:0.3f} avg,")
body.append(f" {entry.max:0.3f} max,")
body.append(f" {entry.min:0.3f} min)")
Expand Down
1 change: 1 addition & 0 deletions grizzly/common/test_status_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ def test_status_reporter_05(mocker, tmp_path):
assert "Runtime" in output
# multiple reports
status = Status.start(db_file, enable_profiling=True)
status.start_time -= 1220
status.ignored = 1
status.iteration = 50
status.results.count("uid1", "sig1")
Expand Down

0 comments on commit 2dcae32

Please sign in to comment.