Connected API client with automatic disconnect on teardown.
(serial_studio_running)
| 45 | |
| 46 | @pytest.fixture |
| 47 | def api_client(serial_studio_running): |
| 48 | """Connected API client with automatic disconnect on teardown.""" |
| 49 | client = SerialStudioClient() |
| 50 | client.connect() |
| 51 | |
| 52 | yield client |
| 53 | |
| 54 | try: |
| 55 | if client.is_connected(): |
| 56 | client.disconnect_device() |
| 57 | except Exception: |
| 58 | pass |
| 59 | |
| 60 | client.disconnect() |
| 61 | |
| 62 | |
| 63 | @pytest.fixture |
nothing calls this directly
no test coverage detected