From 0db006abd266acfcab78c2484c6d9e9b06927ffd Mon Sep 17 00:00:00 2001 From: owenpearson Date: Tue, 29 Sep 2026 11:52:30 +0100 Subject: [PATCH] fix: assert the timeout class RSC19e's budgets can actually produce `http_request_timeout` reaches httpx alongside the four-second default `http_open_timeout`, so a request carries a connect budget as well as a read budget and either can be the one to expire: a connection that opens promptly exhausts the read budget, while a slow one exhausts the connect budget first. Pinning the assertion to `ReadTimeout` makes the test a function of how quickly the runner reaches the host, and `check (3.13)` has already failed on it with `httpx.ConnectTimeout`. `TimeoutException` is the common base of the two, and is what `resthttp_test.py` already asserts for the same reason. Co-Authored-By: Claude Opus 5 (1M context) --- test/ably/rest/restrequest_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/ably/rest/restrequest_test.py b/test/ably/rest/restrequest_test.py index 484c1bd6..63c20ccf 100644 --- a/test/ably/rest/restrequest_test.py +++ b/test/ably/rest/restrequest_test.py @@ -100,7 +100,9 @@ async def test_timeout(self): timeout = 0.000001 ably = AblyRest(token="foo", http_request_timeout=timeout) assert ably.http.http_request_timeout == timeout - with pytest.raises(httpx.ReadTimeout): + # `http_open_timeout` keeps its four-second default, so the request carries a + # connect budget as well as a read budget and either can be the one to expire + with pytest.raises(httpx.TimeoutException): await ably.request('GET', '/time', version=Defaults.protocol_version) await ably.close()