From bc95e163acd51476d740da5800bcd1efee11b59f Mon Sep 17 00:00:00 2001 From: Jaime Silvela Date: Wed, 5 Jun 2024 08:49:52 +0200 Subject: [PATCH] fix: dereference when no failures in bucket Signed-off-by: Jaime Silvela --- summarize_test_results.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/summarize_test_results.py b/summarize_test_results.py index de0b70c..2a1bc4a 100644 --- a/summarize_test_results.py +++ b/summarize_test_results.py @@ -613,7 +613,9 @@ def compute_thermometer_on_metric(summary, metric, embed=True): output = f"{metric_name(metric)} thermometer:\n\n" for bucket_hits in summary[metric]["total"].items(): bucket = bucket_hits[0] # the items() call returns (bucket, hits) pairs - failures = summary[metric]["failed"][bucket] + failures = 0 + if bucket in summary[metric]["failed"]: + failures = summary[metric]["failed"][bucket] runs = summary[metric]["total"][bucket] success_percent = (1 - failures / runs) * 100 color = compute_semaphore(success_percent, embed)