File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -299,3 +299,29 @@ def test_request_fail_419_recover(self, client: ClientBase):
299299
300300 assert client ._session .request .call_count == 2
301301 assert result == {"result" : "data" }
302+
303+ def test_request_fail_timeout (self , client : ClientBase ):
304+ client ._retry_interval_func = constant_backoff_function (0.0 )
305+ client ._session .request .side_effect = requests .exceptions .Timeout ("timeout" )
306+
307+ with pytest .raises (requests .exceptions .Timeout ) as exc :
308+ client .request (method = "GET" , url = "/path" )
309+
310+ assert str (exc .value ) == "timeout"
311+ assert client ._session .request .call_count == 6
312+
313+ def test_request_fail_timeout_recover (self , client : ClientBase ):
314+ client ._retry_interval_func = constant_backoff_function (0.0 )
315+
316+ client ._session .request .side_effect = [
317+ requests .exceptions .Timeout ("timeout" ),
318+ make_response (
319+ status = HTTPStatus .OK ,
320+ json = {"result" : "data" },
321+ ),
322+ ]
323+
324+ result = client .request (method = "GET" , url = "/path" )
325+
326+ assert client ._session .request .call_count == 2
327+ assert result == {"result" : "data" }
You can’t perform that action at this time.
0 commit comments