Skip to content

The agent that grows with you

fix(tests): handle parallel runner help flags

KoNit-K41332e7851ad
diff --git a/scripts/run_tests_parallel.py b/scripts/run_tests_parallel.py
index 4d5e0712f83..c95b8f4501c 100755
--- a/scripts/run_tests_parallel.py
+++ b/scripts/run_tests_parallel.py
@@ -933,7 +933,7 @@ def main() -> int:
# it never reaches our positional ``paths``. ``=``-joined forms
# (``-k=expr``, ``--tb=long``) are self-contained and need no lookahead.
OUR_FLAGS = {
- "-j", "--jobs", "--paths", "--include-integration",
+ "-h", "--help", "-j", "--jobs", "--paths", "--include-integration",
"--file-timeout", "--file-retries", "--slice", "--generate-slices", "--files",
}
# pytest short flags that consume the NEXT token as their value.
diff --git a/tests/scripts/test_run_tests_parallel.py b/tests/scripts/test_run_tests_parallel.py
index aeee6cfa0ea..f1e96d250ee 100644
--- a/tests/scripts/test_run_tests_parallel.py
+++ b/tests/scripts/test_run_tests_parallel.py
@@ -270,6 +270,29 @@ def _run_runner(probe_dir: Path, *extra: str) -> subprocess.CompletedProcess:
)
[email protected]("help_flag", ["-h", "--help"])
+def test_help_prints_usage_without_discovering_or_running_tests(
+ tmp_path: Path, help_flag: str
+) -> None:
+ """Runner help stays in argparse instead of becoming a pytest sweep."""
+ repo_root = Path(__file__).resolve().parent.parent.parent
+ runner = repo_root / "scripts" / "run_tests_parallel.py"
+
+ proc = subprocess.run(
+ [sys.executable, str(runner), "--paths", str(tmp_path / "no-tests"), help_flag],
+ cwd=repo_root,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ encoding="utf-8",
+ errors="replace",
+ timeout=10,
+ )
+
+ assert proc.returncode == 0, proc.stdout
+ assert "usage:" in proc.stdout
+ assert "Discovered" not in proc.stdout
+
+
def test_bare_value_flag_keeps_its_value(tmp_path: Path) -> None: