11"""Tests for async_client configuration."""
22
33from unittest .mock import patch
4- from httpx import AsyncClient , ASGITransport
4+ from httpx import AsyncClient , ASGITransport , Timeout
55
66from basic_memory .mcp .async_client import create_client
77
@@ -25,3 +25,25 @@ def test_create_client_uses_http_when_proxy_env_set():
2525 assert not isinstance (client ._transport , ASGITransport )
2626 # When using remote API, no base_url is set (dynamic from headers)
2727 assert str (client .base_url ) == "http://localhost:8000"
28+
29+
30+ def test_create_client_configures_extended_timeouts ():
31+ """Test that create_client configures 30-second timeouts for long operations."""
32+ with patch .dict ("os.environ" , {}, clear = True ):
33+ client = create_client ()
34+
35+ # Verify timeout configuration
36+ assert isinstance (client .timeout , Timeout )
37+ assert client .timeout .connect == 10.0 # 10 seconds for connection
38+ assert client .timeout .read == 30.0 # 30 seconds for reading
39+ assert client .timeout .write == 30.0 # 30 seconds for writing
40+ assert client .timeout .pool == 30.0 # 30 seconds for pool
41+
42+ # Also test with proxy URL
43+ with patch .dict ("os.environ" , {"BASIC_MEMORY_PROXY_URL" : "http://localhost:8000" }):
44+ client = create_client ()
45+
46+ # Same timeout configuration should apply
47+ assert isinstance (client .timeout , Timeout )
48+ assert client .timeout .read == 30.0
49+ assert client .timeout .write == 30.0
0 commit comments