Test that 'hq server wait' times out when no server is running
(hq_env: HqEnv, tmp_path)
| 281 | |
| 282 | |
| 283 | def test_server_wait_timeout_no_server(hq_env: HqEnv, tmp_path): |
| 284 | """Test that 'hq server wait' times out when no server is running""" |
| 285 | start_time = time.time() |
| 286 | |
| 287 | with pytest.raises(Exception, match=r"Timeout after 2s.*Could not connect to server"): |
| 288 | hq_env.command(["server", "wait", "--timeout", "2s", "--server-dir", str(tmp_path)], use_server_dir=False) |
| 289 | |
| 290 | elapsed = time.time() - start_time |
| 291 | |
| 292 | # Should timeout after roughly 2 seconds (allow some tolerance) |
| 293 | assert 1.5 < elapsed < 4.0 |
| 294 | |
| 295 | |
| 296 | def test_server_wait_success_immediate(hq_env: HqEnv): |