MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / cmd_test

Function cmd_test

examples/API Test/test_api.py:733–763  ·  view source on GitHub ↗

Run the smoke test suite. Self-discovers the live command surface.

(api: SerialStudioAPI, args)

Source from the content-addressed store, hash-verified

731
732
733def 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# =============================================================================

Callers 1

mainFunction · 0.85

Calls 10

print_summaryMethod · 0.95
boldFunction · 0.85
dimFunction · 0.85
TestSuiteClass · 0.85
test_protocolFunction · 0.85
test_command_registryFunction · 0.85
test_smokeFunction · 0.85
test_blocked_commandsFunction · 0.85
errorFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected