From f849efdf6d92cf25c58f7722f50681a9179daed3 Mon Sep 17 00:00:00 2001 From: GustawMatuszewski Date: Wed, 25 Nov 2026 11:03:52 +0100 Subject: [PATCH] progress_dashboard: --tests without --run-tests is the usage error, not a silent no-op `--tests` is only read inside the `--run-tests` branch, so `--tests test_boot_trace` on its own exited 0 and wrote a dashboard without running the requested tests, and an invalid `--tests` regular expression was diagnosed only once tests actually ran. Refuse the combination before anything is written. tests/test_progress_dashboard.py: the new case checks exit 2, the message, no traceback and no output folder, for a plain filter and for an invalid one. python -I tests/test_progress_dashboard.py: 51 tests, 0 failures. --- tests/test_progress_dashboard.py | 12 ++++++++++++ tools/progress_dashboard.py | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/test_progress_dashboard.py b/tests/test_progress_dashboard.py index ad22e8149..4980eb004 100644 --- a/tests/test_progress_dashboard.py +++ b/tests/test_progress_dashboard.py @@ -579,6 +579,18 @@ def test_invalid_test_filter_is_an_argument_error(self): self.assertNotIn(b"Traceback", result.stderr) self.assertFalse(os.path.exists(out)) + def test_tests_without_run_tests_is_an_argument_error(self): + with tempfile.TemporaryDirectory() as tmp: + out = os.path.join(tmp, "out") + for regex in ("test_boot_trace", "["): + with self.subTest(regex=regex): + result = subprocess.run([sys.executable, "-I", TOOL, "--out", out, "--tests", regex], + capture_output=True, cwd=ROOT, timeout=120) + self.assertEqual(result.returncode, 2, result.stderr.decode("utf-8", "replace")) + self.assertIn(b"--tests requires --run-tests", result.stderr) + self.assertNotIn(b"Traceback", result.stderr) + self.assertFalse(os.path.exists(out)) + def test_out_inside_the_repository_is_refused(self): r = subprocess.run([sys.executable, "-I", TOOL, "--out", os.path.join(ROOT, "progress_out_test")], capture_output=True, cwd=ROOT, timeout=120) diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index 600179f5f..857a507cf 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py @@ -1,7 +1,8 @@ """Progress dashboard: what works, what changed and what blocks next, from outcomes the project already produces. python -I tools/progress_dashboard.py --out [--work ] [--run-tests] - [--ctest-junit FILE] [--junit FILE ...] [--github] [--login NAME] + [--tests REGEX] [--ctest-junit FILE] [--junit FILE ...] [--github] + [--login NAME] Writes, into --out only (a folder inside the repository is refused, so nothing here can be committed by accident): progress.html one self-contained page (no network, no packages; open it from disk) @@ -1062,6 +1063,8 @@ def main(argv=None): ap.error("--jobs must be a positive integer") if args.test_timeout < 1: ap.error("--test-timeout must be a positive integer") + if args.tests is not None and not args.run_tests: + ap.error("--tests requires --run-tests") if args.run_tests and args.tests: try: args.tests = re.compile(args.tests)