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

Function api_client

tests/integration/conftest.py:49–70  ·  view source on GitHub ↗

Provide a connected API client. Automatically connects and disconnects. The command timeout is wider than the client default because functional tests should survive a transient CI-runner stall; the security suite keeps short timeouts on purpose (there a TimeoutError means a han

(serial_studio_running)

Source from the content-addressed store, hash-verified

47
48@pytest.fixture
49def api_client(serial_studio_running):
50 """
51 Provide a connected API client.
52
53 Automatically connects and disconnects. The command timeout is wider
54 than the client default because functional tests should survive a
55 transient CI-runner stall; the security suite keeps short timeouts on
56 purpose (there a TimeoutError means a hang). Real hangs are still
57 bounded by the 30 s per-test pytest timeout.
58 """
59 client = SerialStudioClient(timeout=15.0)
60 client.connect()
61
62 yield client
63
64 try:
65 if client.is_connected():
66 client.disconnect_device()
67 except Exception:
68 pass
69
70 client.disconnect()
71
72
73@pytest.fixture

Callers

nothing calls this directly

Calls 5

connectMethod · 0.95
is_connectedMethod · 0.95
disconnect_deviceMethod · 0.95
disconnectMethod · 0.95
SerialStudioClientClass · 0.90

Tested by

no test coverage detected