Skip to content

Commit 2824c36

Browse files
phernandezclaude
andcommitted
fix: Windows test failures by preserving HOME environment variable
The tests were using patch.dict("os.environ", {}, clear=True) which cleared ALL environment variables including HOME/USERPROFILE. This caused Path.home() to fail on Windows when ConfigManager tried to initialize. Fixed by using os.environ.pop() to remove only specific env vars being tested while preserving HOME/USERPROFILE for cross-platform compatibility. Fixes #322 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent c6e00bf commit 2824c36

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/api/test_async_client.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for async_client configuration."""
22

3+
import os
34
from unittest.mock import patch
45
from httpx import AsyncClient, ASGITransport, Timeout
56

@@ -9,7 +10,11 @@
910

1011
def test_create_client_uses_asgi_when_no_remote_env():
1112
"""Test that create_client uses ASGI transport when BASIC_MEMORY_USE_REMOTE_API is not set."""
12-
with patch.dict("os.environ", {}, clear=True):
13+
# Ensure env vars are not set (pop if they exist)
14+
with patch.dict("os.environ", clear=False):
15+
os.environ.pop("BASIC_MEMORY_USE_REMOTE_API", None)
16+
os.environ.pop("BASIC_MEMORY_CLOUD_MODE", None)
17+
1318
client = create_client()
1419

1520
assert isinstance(client, AsyncClient)
@@ -32,7 +37,11 @@ def test_create_client_uses_http_when_cloud_mode_env_set():
3237

3338
def test_create_client_configures_extended_timeouts():
3439
"""Test that create_client configures 30-second timeouts for long operations."""
35-
with patch.dict("os.environ", {}, clear=True):
40+
# Ensure env vars are not set (pop if they exist)
41+
with patch.dict("os.environ", clear=False):
42+
os.environ.pop("BASIC_MEMORY_USE_REMOTE_API", None)
43+
os.environ.pop("BASIC_MEMORY_CLOUD_MODE", None)
44+
3645
client = create_client()
3746

3847
# Verify timeout configuration

0 commit comments

Comments
 (0)