From 2417f2e5fc9ca0b6b1032b67936a04e08bf0ffc7 Mon Sep 17 00:00:00 2001 From: Husam Soboh Date: Sun, 22 Mar 2026 17:02:05 +0200 Subject: [PATCH] fix(test): resolve flaky CSRF test on macOS Python 3.9 When server rejects with 403 and resets connection, return the HTTP error code directly instead of retrying (retry sends same bad token). Co-Authored-By: Claude --- cloudhop/tests/test_server_integration.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cloudhop/tests/test_server_integration.py b/cloudhop/tests/test_server_integration.py index 7901da8..d62f1fa 100644 --- a/cloudhop/tests/test_server_integration.py +++ b/cloudhop/tests/test_server_integration.py @@ -167,11 +167,9 @@ def _fetch_raw(req: urllib.request.Request, timeout: int = 5): BrokenPipeError, ConnectionRefusedError, ): - if attempt < _MAX_RETRIES - 1: - time.sleep(0.5) - req = _rebuild_request(req) - else: - raise + # Server rejected and reset connection (e.g. CSRF 403). + # Return the HTTP error code instead of retrying. + return e.code, b"" except ( ConnectionResetError, ConnectionAbortedError,