fix ruff warnings

This commit is contained in:
Sylvestre Ledru 2025-03-18 20:36:38 +01:00
parent 663a9202e5
commit b1c3175387
5 changed files with 12 additions and 9 deletions

View file

@ -29,6 +29,7 @@ Output:
Prints shell export statements for TOTAL, PASS, FAIL, SKIP, XPASS, and ERROR
that can be evaluated in a shell environment.
"""
import json
import sys
from collections import defaultdict

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python3
"""
Compare the current results to the last results gathered from the main branch to highlight
if a PR is making the results better/worse.
Compare the current results to the last results gathered from the main branch to
highlight if a PR is making the results better/worse.
Don't exit with error code if all failing tests are in the ignore-intermittent.txt list.
"""
@ -28,13 +28,15 @@ skip_d = int(current["skip"]) - int(last["skip"])
# Get an annotation to highlight changes
print(
f"::warning ::Changes from '{REPO_DEFAULT_BRANCH}': PASS {pass_d:+d} / FAIL {fail_d:+d} / ERROR {error_d:+d} / SKIP {skip_d:+d} "
f"""::warning ::Changes from '{REPO_DEFAULT_BRANCH}': PASS {pass_d:+d} /
FAIL {fail_d:+d} / ERROR {error_d:+d} / SKIP {skip_d:+d}"""
)
# If results are worse, check if we should fail the job
if pass_d < 0:
print(
f"::error ::PASS count is reduced from '{REPO_DEFAULT_BRANCH}': PASS {pass_d:+d} "
f"""::error ::PASS count is reduced from
'{REPO_DEFAULT_BRANCH}': PASS {pass_d:+d}"""
)
# Check if all failing tests are intermittent based on the environment variable

View file

@ -37,5 +37,4 @@ for filepath in test_dir.glob("**/*.log"):
except Exception as e:
print(f"Error processing file {path}: {e}", file=sys.stderr)
print(json.dumps(out, indent=2, sort_keys=True))

View file

@ -39,9 +39,9 @@ for files in types:
list_of_files = sorted(tests, key=lambda x: os.stat(x).st_size)
def show_list(l):
def show_list(list_test):
# Remove the factor tests and reverse the list (bigger first)
tests = list(filter(lambda k: "factor" not in k, l))
tests = list(filter(lambda k: "factor" not in k, list_test))
for f in reversed(tests):
if contains_require_root(f):

View file

@ -75,8 +75,9 @@ collect_diff(2, "opt-level")
collect_diff(3, "lto")
def analyze(l):
return f"MIN: {float(min(l)):.3}, AVG: {float(sum(l)/len(l)):.3}, MAX: {float(max(l)):.3}"
def analyze(change):
return f"""MIN: {float(min(change)):.3},
AVG: {float(sum(change) / len(change)):.3}, MAX: {float(max(change)):.3}"""
print("Absolute changes")