Provide an API client for security testing. Does NOT automatically clean state - security tests may want to test dirty/invalid states. Skips test if server is unavailable (e.g., crashed by previous test).
(api_server_required)
| 93 | |
| 94 | @pytest.fixture |
| 95 | def security_client(api_server_required): |
| 96 | """ |
| 97 | Provide an API client for security testing. |
| 98 | |
| 99 | Does NOT automatically clean state - security tests may want |
| 100 | to test dirty/invalid states. |
| 101 | |
| 102 | Skips test if server is unavailable (e.g., crashed by previous test). |
| 103 | """ |
| 104 | client = SerialStudioClient(timeout=5.0) |
| 105 | |
| 106 | try: |
| 107 | client.connect() |
| 108 | except ConnectionError as e: |
| 109 | pytest.skip(f"Server unavailable (may have crashed from previous test): {e}") |
| 110 | |
| 111 | yield client |
| 112 | |
| 113 | # Cleanup - but don't fail if server is unresponsive |
| 114 | try: |
| 115 | client.disconnect() |
| 116 | except Exception: |
| 117 | pass |
| 118 | |
| 119 | |
| 120 | @pytest.fixture |
nothing calls this directly
no test coverage detected