Skip to content

Commit b89eef6

Browse files
authored
fix: do not round up percentages (#15)
Signed-off-by: Marco Nenciarini <[email protected]>
1 parent 2a6ea8d commit b89eef6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

summarize_test_results.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import argparse
5454
from datetime import datetime
5555
import json
56+
import math
5657
import os
5758
import pathlib
5859
from prettytable import MARKDOWN
@@ -628,7 +629,9 @@ def compute_thermometer_on_metric(summary, metric, embed=True):
628629
runs = summary[metric]["total"][bucket]
629630
success_percent = (1 - failures / runs) * 100
630631
color = compute_semaphore(success_percent, embed)
631-
output += f"- {color} - {bucket}: {round(success_percent, 1)}% success.\t"
632+
output += (
633+
f"- {color} - {bucket}: {math.floor(success_percent*10)/10}% success.\t"
634+
)
632635
output += f"({failures} out of {runs} tests failed)\n"
633636
output += f"\n"
634637
return output

test_summary.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_compute_thermometer(self):
7676
self.assertEqual(
7777
thermometer,
7878
"Platforms thermometer:\n\n"
79-
"- 🔴 - local: 66.7% success.\t(1 out of 3 tests failed)\n\n",
79+
"- 🔴 - local: 66.6% success.\t(1 out of 3 tests failed)\n\n",
8080
)
8181

8282
thermometerPlaintext = summarize_test_results.compute_thermometer_on_metric(
@@ -86,7 +86,7 @@ def test_compute_thermometer(self):
8686
self.assertEqual(
8787
thermometerPlaintext,
8888
"Platforms thermometer:\n\n"
89-
"- :red_circle: - local: 66.7% success.\t(1 out of 3 tests failed)\n\n",
89+
"- :red_circle: - local: 66.6% success.\t(1 out of 3 tests failed)\n\n",
9090
)
9191

9292
def test_compute_systematic_failures(self):

0 commit comments

Comments
 (0)