Skip to content

Commit 9cfdf6d

Browse files
committed
Clean code
1 parent 40259a3 commit 9cfdf6d

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

.github/scripts/merge_retagger_results.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
# ================================
22
#
3-
# OK- Read No of retagger batches
4-
# OK- Artifact is exported as python-unittest-retagger-gate-batch{NO}-{OS}-{ARCH}-jdk-latest_logs
5-
#
6-
# list => new job => require_artifacts: reports list
7-
#
8-
# Download all artifacts => extraxt => filter by name retagger-report
9-
# OK- Merge => report-merged.json
10-
# run mx merge-tags-from-report => git diff => export git diff artifact
3+
# This script is used by ci to merge several retagger report JSON files, which is then used
4+
# by running python3 runner.py merge-tags-from-reports reports-merged.json
115
#
126
# ================================
137

@@ -18,14 +12,15 @@
1812
import argparse
1913
from dataclasses import dataclass
2014

21-
# Tests' status we want to merge and export
15+
# status we want to focus on
2216
EXPORT_STATUS = ["FAILED"]
2317

2418
@dataclass
2519
class Test:
26-
name: str
27-
status: str
28-
duration: str
20+
name: str
21+
status: str
22+
duration: str
23+
2924

3025
def read_report(path: str) -> list[Test]:
3126
tests = []
@@ -39,15 +34,16 @@ def read_report(path: str) -> list[Test]:
3934

4035
def merge_tests(report: list[Test], merged: dict[str, dict]):
4136
for test in report:
42-
if test.name not in merged: merged[test.name] = test.__dict__
37+
if test.name not in merged:
38+
merged[test.name] = test.__dict__
4339

4440
def export_reports(merged: dict[str, dict], outfile: str):
4541
with open(outfile, "w") as f:
4642
json.dump(list(merged.values()), f)
47-
print(f"=== Exported {len(merged)} failing tests to {f.name} ===")
43+
print(f"=== Exported {len(merged)} ({EXPORT_STATUS}) tests to {f.name} ===")
4844

4945
def merge_reports(reports: list[str], outfile: str):
50-
merged_reports = {} # key: test_name
46+
merged_reports = {}
5147
for report in reports:
5248
report_tests = read_report(report)
5349
merge_tests(report_tests, merged_reports)

graalpython/com.oracle.graal.python.test/src/runner.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,10 @@ def run_tests(self, tests: list['TestSuite']):
446446
self.display_summary()
447447

448448
def generate_mx_report(self, path: str):
449-
# Some reports, such as retagger, are split in batches when ran on github ci
450-
# This allows to upload them as artifacts
449+
# Some reports may be split when ran on github, this sets different file names
451450
report_suffix = os.environ.get("MX_REPORT_SUFFIX")
452451
if report_suffix:
453-
tmppath,ext = os.path.splitext(path)
452+
tmppath, ext = os.path.splitext(path)
454453
path = f"{tmppath}{report_suffix}{ext}"
455454

456455
report_data = []

0 commit comments

Comments
 (0)