From 1bb4488f9f11f974c1f44247e9689928ab36a15b Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Wed, 5 Jun 2024 18:29:46 -0400 Subject: [PATCH] DE-819 | initial commit --- arango/http.py | 4 +++- tests/test_client.py | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/arango/http.py b/arango/http.py index d0b17939..4469af55 100644 --- a/arango/http.py +++ b/arango/http.py @@ -154,9 +154,11 @@ class DefaultHTTPClient(HTTPClient): :type pool_timeout: int | float | None """ + REQUEST_TIMEOUT = DEFAULT_REQUEST_TIMEOUT + def __init__( self, - request_timeout: Union[int, float, None] = DEFAULT_REQUEST_TIMEOUT, + request_timeout: Union[int, float, None] = REQUEST_TIMEOUT, retry_attempts: int = 3, backoff_factor: float = 1.0, pool_connections: int = 10, diff --git a/tests/test_client.py b/tests/test_client.py index a196a8fd..0e79762e 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -110,6 +110,31 @@ def test_client_http_client_attributes(db, username, password): assert http_client.request_timeout == 80 assert client.request_timeout == http_client.request_timeout + client_no_timeout = ArangoClient( + hosts="http://127.0.0.1:8529", request_timeout=None + ) + + assert client_no_timeout.request_timeout is None + + client_no_timeout = ArangoClient( + hosts="http://127.0.0.1:8529", + http_client=DefaultHTTPClient(request_timeout=None), + ) + + assert client_no_timeout.request_timeout is None + + class NoTimeoutHTTPClient(DefaultHTTPClient): + REQUEST_TIMEOUT = None + + def __init__(self, *args, **kwargs): + super().__init__(request_timeout=self.REQUEST_TIMEOUT, *args, **kwargs) + + client_no_timeout = ArangoClient( + hosts="http://127.0.0.1:8529", http_client=NoTimeoutHTTPClient() + ) + + assert client_no_timeout.request_timeout is None + def test_client_custom_http_client(db, username, password): # Define custom HTTP client which increments the counter on any API call.