Run the smoke test suite. Self-discovers the live command surface.
(api: SerialStudioAPI, args)
| 731 | |
| 732 | |
| 733 | def cmd_test(api: SerialStudioAPI, args) -> int: |
| 734 | """Run the smoke test suite. Self-discovers the live command surface.""" |
| 735 | print(bold("=" * 60)) |
| 736 | print(bold("Serial Studio API Smoke Test")) |
| 737 | print(bold("=" * 60)) |
| 738 | print() |
| 739 | print(dim("This suite exercises a handful of read-only commands per scope")) |
| 740 | print(dim("and checks protocol-level invariants. It does NOT verify every")) |
| 741 | print(dim("command's behavior -- use the live registry (api.getCommands)")) |
| 742 | print(dim("for that.")) |
| 743 | |
| 744 | suite = TestSuite("Serial Studio API") |
| 745 | |
| 746 | try: |
| 747 | test_protocol(api, suite) |
| 748 | commands = test_command_registry(api, suite) |
| 749 | |
| 750 | if commands is not None: |
| 751 | available = {c.get("name", "") for c in commands} |
| 752 | test_smoke(api, suite, available) |
| 753 | test_blocked_commands(api, suite, available) |
| 754 | except KeyboardInterrupt: |
| 755 | print(error("\n[INTERRUPTED] Tests cancelled by user")) |
| 756 | except Exception as e: |
| 757 | print(error(f"\n[FATAL] Unexpected error: {e}")) |
| 758 | import traceback |
| 759 | |
| 760 | traceback.print_exc() |
| 761 | |
| 762 | suite.print_summary() |
| 763 | return 0 if suite.failed == 0 else 1 |
| 764 | |
| 765 | |
| 766 | # ============================================================================= |
no test coverage detected