From 5eafd67c335fdde93c0dd56c6319aeee6dd905cb Mon Sep 17 00:00:00 2001 From: thrialectics <203729272+thrialectics@users.noreply.github.com> Date: Tue, 5 May 2026 12:31:23 -0400 Subject: [PATCH] fix(tests/unified): use argparse mutex group for --test-dir/--test-file The previous mutual-exclusion check compared --test-dir against its default string literal, so passing --test-file together with an explicit --test-dir tests/unified/test_cases silently bypassed the check. Replace with argparse.add_mutually_exclusive_group() and apply the default path post-parse so the bare invocation still works. --- tests/unified/run.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/unified/run.py b/tests/unified/run.py index b9e4a576..c0848471 100644 --- a/tests/unified/run.py +++ b/tests/unified/run.py @@ -12,13 +12,13 @@ from tests.unified.runner import UnifiedTestRunner async def main(): parser = argparse.ArgumentParser(description="Run Unified Honcho Tests") - parser.add_argument( + target_group = parser.add_mutually_exclusive_group() + target_group.add_argument( "--test-dir", type=str, - default="tests/unified/test_cases", help="Directory containing JSON test files", ) - parser.add_argument( + target_group.add_argument( "--test-file", type=str, help="Path to a single JSON test file to run", @@ -32,10 +32,8 @@ async def main(): args = parser.parse_args() - # Validate mutually exclusive args - if args.test_file and args.test_dir != "tests/unified/test_cases": - print("Error: Cannot specify both --test-file and --test-dir") - sys.exit(1) + if args.test_file is None and args.test_dir is None: + args.test_dir = "tests/unified/test_cases" if args.test_file: test_path = Path(args.test_file)