@@ -454,16 +454,10 @@ class YAMLTestRunner: |
| 454 | 454 | |
| 455 | 455 | def find_shell_binary() -> str: |
| 456 | 456 | """Find the shell binary.""" |
| 457 | | - # Check common locations |
| 458 | | - candidates = [ |
| 459 | | - # removed — bensch requires explicit --shell, |
| 460 | | - # path, |
| 461 | | - , |
| 462 | | - , |
| 463 | | - ] |
| 464 | | - |
| 465 | | - # Also check FORTSH environment variable |
| 466 | | - env_path = os.environ.get('FORTSH') |
| 457 | + candidates = [] |
| 458 | + |
| 459 | + # Check SHELL_BIN or SHELL environment variables |
| 460 | + env_path = os.environ.get('SHELL_BIN') or os.environ.get('SHELL') |
| 467 | 461 | if env_path: |
| 468 | 462 | candidates.insert(0, env_path) |
| 469 | 463 | |
@@ -516,15 +510,20 @@ def main(): |
| 516 | 510 | description="Run interactive tests for shell" |
| 517 | 511 | ) |
| 518 | 512 | parser.add_argument( |
| 519 | | - '--shell', '-s', |
| 513 | + '--shell', |
| 520 | 514 | default=None, |
| 521 | 515 | help='Path to shell binary' |
| 522 | 516 | ) |
| 523 | 517 | parser.add_argument( |
| 524 | | - '--spec', '-s', |
| 518 | + '--spec', |
| 525 | 519 | default=None, |
| 526 | 520 | help='Run specific YAML spec file' |
| 527 | 521 | ) |
| 522 | + parser.add_argument( |
| 523 | + '--spec-dir', |
| 524 | + default=None, |
| 525 | + help='Directory containing YAML spec subdirectories' |
| 526 | + ) |
| 528 | 527 | parser.add_argument( |
| 529 | 528 | '--pytest', |
| 530 | 529 | action='store_true', |
@@ -562,9 +561,24 @@ def main(): |
| 562 | 561 | test_dir = Path(__file__).parent |
| 563 | 562 | return pytest.main([str(test_dir), '-v' if args.verbose else '-q']) |
| 564 | 563 | |
| 564 | + # Load profile if available |
| 565 | + profile = {} |
| 566 | + profile_name = os.environ.get('BENSCH_PROFILE', '') |
| 567 | + if profile_name: |
| 568 | + try: |
| 569 | + from profile import load_profile |
| 570 | + profile = load_profile(profile_name) |
| 571 | + except Exception: |
| 572 | + pass |
| 573 | + |
| 565 | 574 | # Run YAML specs |
| 566 | | - runner = YAMLTestRunner(shell_path, verbose=args.verbose) |
| 567 | | - test_dir = Path(__file__).parent / "test_specs" |
| 575 | + runner = YAMLTestRunner(shell_path, verbose=args.verbose, profile=profile) |
| 576 | + |
| 577 | + # Determine spec directory |
| 578 | + if args.spec_dir: |
| 579 | + test_dir = Path(args.spec_dir) |
| 580 | + else: |
| 581 | + test_dir = Path(__file__).parent / "test_specs" |
| 568 | 582 | |
| 569 | 583 | if args.spec: |
| 570 | 584 | # Run specific spec |
@@ -576,9 +590,9 @@ def main(): |
| 576 | 590 | return 1 |
| 577 | 591 | results = runner.run_spec_file(spec_path) |
| 578 | 592 | else: |
| 579 | | - # Run all specs |
| 593 | + # Run all specs (recursively find YAML files) |
| 580 | 594 | results = [] |
| 581 | | - for spec_file in sorted(test_dir.glob("*.yaml")): |
| 595 | + for spec_file in sorted(test_dir.rglob("*.yaml")): |
| 582 | 596 | results.extend(runner.run_spec_file(spec_file)) |
| 583 | 597 | |
| 584 | 598 | # Print summary |