summaryrefslogtreecommitdiff
path: root/run_project_tests.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-08-15 11:08:26 -0400
committerEli Schwartz <eschwartz@archlinux.org>2021-10-04 16:29:30 -0400
commite8a85fa8a2cdbbcd5dcefd9152be67e4416338ca (patch)
tree83ed77c6e7372b73fc7f84cb326fd95808335be8 /run_project_tests.py
parent2d65472c725f18b343aee00bf91b9ac98c08b95f (diff)
downloadmeson-e8a85fa8a2cdbbcd5dcefd9152be67e4416338ca.tar.gz
various python neatness cleanups
All changes were created by running "pyupgrade --py3-only" and committing the results. Although this has been performed in the past, newer versions of pyupgrade can automatically catch more opportunities, notably list comprehensions can use generators instead, in the following cases: - unpacking into function arguments as function(*generator) - unpacking into assignments of the form x, y = generator - as the argument to some builtin functions such as min/max/sorted Also catch a few creeping cases of new code added using older styles.
Diffstat (limited to 'run_project_tests.py')
-rwxr-xr-xrun_project_tests.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index 1d4237e1a..0619bdf7a 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -1253,11 +1253,11 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
f.status = TestStatus.CANCELED
if stop and not tests_canceled:
- num_running = sum([1 if f2.status is TestStatus.RUNNING else 0 for f2 in futures])
+ num_running = sum(1 if f2.status is TestStatus.RUNNING else 0 for f2 in futures)
for f2 in futures:
f2.cancel()
executor.shutdown()
- num_canceled = sum([1 if f2.status is TestStatus.CANCELED else 0 for f2 in futures])
+ num_canceled = sum(1 if f2.status is TestStatus.CANCELED else 0 for f2 in futures)
safe_print(f'\nCanceled {num_canceled} out of {num_running} running tests.')
safe_print(f'Finishing the remaining {num_running - num_canceled} tests.\n')
tests_canceled = True
@@ -1297,7 +1297,7 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
else:
skip_msg = 'Test ran, but was expected to be skipped'
status = TestStatus.UNEXRUN
- result.msg = "%s for MESON_CI_JOBNAME '%s'" % (skip_msg, ci_jobname)
+ result.msg = f"{skip_msg} for MESON_CI_JOBNAME '{ci_jobname}'"
f.update_log(status)
current_test = ET.SubElement(current_suite, 'testcase', {'name': testname, 'classname': t.category})
@@ -1479,7 +1479,7 @@ def print_tool_versions() -> None:
args = [t.tool] + t.args
pc, o, e = Popen_safe(args)
if pc.returncode != 0:
- return '{} (invalid {} executable)'.format(exe, t.tool)
+ return f'{exe} (invalid {t.tool} executable)'
for i in o.split('\n'):
i = i.strip('\n\r\t ')
m = t.regex.match(i)