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)