fix(rectification): expand quality-gate pytest globs before argv
Independent Staging Quality Gate / validate (pull_request) Successful in 13m37s
Independent Staging Quality Gate / publish (pull_request) Has been skipped

subprocess.run does not shell-expand tests/test_rectification_*.py, so a
string pin could stay green while the suite never ran. Expand glob targets
to real files and fail closed on zero matches.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-01 19:13:38 +08:00
co-authored by Cursor
parent c48a965640
commit 901cdb96ef
2 changed files with 40 additions and 2 deletions
@@ -132,8 +132,21 @@ class RectificationDiagnosticsClustersTest(unittest.TestCase):
def test_staging_quick_gate_runs_rectification_python_suite(self) -> None:
from pathlib import Path
from scripts.run_quality_gate import CORE_PYTEST_TARGETS, _expand_pytest_targets
glob_target = "tests/test_rectification_*.py"
text = Path("scripts/run_quality_gate.py").read_text(encoding="utf-8")
self.assertIn('"tests/test_rectification_*.py"', text)
self.assertIn(f'"{glob_target}"', text)
self.assertIn(glob_target, CORE_PYTEST_TARGETS)
expanded = _expand_pytest_targets([glob_target])
self.assertGreaterEqual(len(expanded), 6)
self.assertTrue(all(
item.startswith("tests/test_rectification_") and item.endswith(".py")
for item in expanded
))
with self.assertRaises(SystemExit):
_expand_pytest_targets(["tests/no_such_rectification_glob_*.py"])
if __name__ == "__main__":