From 92a06a8efbb3a213fa8b98f1e2ce4da523731071 Mon Sep 17 00:00:00 2001 From: Jarry Shaw Date: Thu, 22 Oct 2026 19:10:41 -0400 Subject: [PATCH] refactor(util): move ci_timing and vendor_test_gate onto the Actions helper (#2047) - util/ci_timing.py: its annotations go through util/_actions.py. Those that carry text from elsewhere (an API error, the stopped-early note, a finding) stay unescaped, escape=False, as before; output is unchanged. - util/vendor_test_gate.py: annotations, the per-run ::group::, the step summary and the verdict output go through the helper; its own escape() goes, the helper's escaping being the same. Output is unchanged. - tests/project/test_actions_helper_2047.py lists both scripts. - util/python_versions.py stays as it is: several workflows check it out alone, and create-release.yml runs a released copy of it by itself, so it cannot import the helper. --- tests/project/test_actions_helper_2047.py | 6 ++- util/ci_timing.py | 19 ++++--- util/vendor_test_gate.py | 63 ++++++++++------------- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/tests/project/test_actions_helper_2047.py b/tests/project/test_actions_helper_2047.py index c6c0d6936f..b19a4a6fe1 100644 --- a/tests/project/test_actions_helper_2047.py +++ b/tests/project/test_actions_helper_2047.py @@ -40,8 +40,8 @@ ROOT = pathlib.Path(__file__).resolve().parents[2] HELPER = ROOT / 'util' / '_actions.py' #: The scripts that import the helper. -SCRIPTS = ('apt_packages', 'classify_changes', 'codeql_report', 'coverage_report', 'leg_summary', 'pip_install', - 'regenerate_samples', 'vendor_code_changed') +SCRIPTS = ('apt_packages', 'ci_timing', 'classify_changes', 'codeql_report', 'coverage_report', 'leg_summary', + 'pip_install', 'regenerate_samples', 'vendor_code_changed', 'vendor_test_gate') #: The top-level modules the helper may import, each in Python 3.7's standard #: library: the running interpreter's :data:`sys.stdlib_module_names` would #: pass ``tomllib``, which 3.7 lacks. @@ -49,6 +49,7 @@ #: A trivial run of each script, ``(arguments, environment)``, that gets past its imports. RUNS = { 'apt_packages': (['--help'], {}), + 'ci_timing': (['--help'], {}), 'classify_changes': ([], {'OWN_PR': 'false'}), 'codeql_report': (['--help'], {}), 'coverage_report': (['--help'], {}), @@ -56,6 +57,7 @@ 'pip_install': (['--help'], {}), 'regenerate_samples': (['--help'], {}), 'vendor_code_changed': (['--help'], {}), + 'vendor_test_gate': (['--help'], {}), } #: ``-X importtime``'s line for a module, by its name. IMPORT_TIME = re.compile(r'^import time:.*\|\s*(\S+)\s*$', re.M) diff --git a/util/ci_timing.py b/util/ci_timing.py index 4e9a1c4da1..e28a383fbb 100644 --- a/util/ci_timing.py +++ b/util/ci_timing.py @@ -89,6 +89,11 @@ import requests +try: # #2047: run as `python util/