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)
| 47 | |
| 48 | @pytest.fixture |
| 49 | def 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 |
nothing calls this directly
no test coverage detected