Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not round up percentages #15

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion summarize_test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import argparse
from datetime import datetime
import json
import math
import os
import pathlib
from prettytable import MARKDOWN
Expand Down Expand Up @@ -628,7 +629,9 @@ def compute_thermometer_on_metric(summary, metric, embed=True):
runs = summary[metric]["total"][bucket]
success_percent = (1 - failures / runs) * 100
color = compute_semaphore(success_percent, embed)
output += f"- {color} - {bucket}: {round(success_percent, 1)}% success.\t"
output += (
f"- {color} - {bucket}: {math.floor(success_percent*10)/10}% success.\t"
)
output += f"({failures} out of {runs} tests failed)\n"
output += f"\n"
return output
Expand Down
4 changes: 2 additions & 2 deletions test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_compute_thermometer(self):
self.assertEqual(
thermometer,
"Platforms thermometer:\n\n"
"- 🔴 - local: 66.7% success.\t(1 out of 3 tests failed)\n\n",
"- 🔴 - local: 66.6% success.\t(1 out of 3 tests failed)\n\n",
)

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

def test_compute_systematic_failures(self):
Expand Down