fix(rectification): expand quality-gate pytest globs before argv
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:
@@ -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__":
|
||||
|
||||
Reference in New Issue
Block a user