Skip to content

Commit 2f08fde

Browse files
committed
Don't fail with 'mean requires at least one data point' when num_failing_pushes_with_config_group is 0
1 parent 01049cd commit 2f08fde

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

bugbug/models/testselect.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,11 +838,16 @@ def do_eval(
838838
if num_failing_pushes_with_config_group > 0
839839
else 1
840840
)
841-
average_caught_percentage_config_group = 100 * statistics.mean(
842-
result["caught_percentage_config_group"]
843-
for result in test_pushes.values()
844-
if "caught_percentage_config_group" in result
845-
and result["caught_percentage_config_group"] is not None
841+
average_caught_percentage_config_group = (
842+
100
843+
* statistics.mean(
844+
result["caught_percentage_config_group"]
845+
for result in test_pushes.values()
846+
if "caught_percentage_config_group" in result
847+
and result["caught_percentage_config_group"] is not None
848+
)
849+
if num_failing_pushes_with_config_group > 0
850+
else 1
846851
)
847852

848853
message += f" In {percentage_caught_one_config_group}% of pushes we caught at least one config/group failure. On average, we caught {average_caught_percentage_config_group}% of all seen config/group failures."

0 commit comments

Comments
 (0)