Skip to content

Commit

Permalink
DE-819 | initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aMahanna committed Jun 5, 2024
1 parent e44a3e8 commit 1bb4488
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arango/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
25 changes: 25 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1bb4488

Please sign in to comment.