The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
fix(cli): resolve Windows environment compatibility issues in python CLI tests (#5464)
UmranPros1d56f8570502
diff --git a/cli/python/tests/test_agent_mode.py b/cli/python/tests/test_agent_mode.pyindex 78f0ca48c..d7b609e15 100644--- a/cli/python/tests/test_agent_mode.py+++ b/cli/python/tests/test_agent_mode.py@@ -32,12 +32,13 @@ def _run(args: list[str], home_dir: str | None = None) -> subprocess.CompletedPrif key.startswith("MEM0_"):del env[key]env.pop("FORCE_COLOR", None)+ env["PYTHONIOENCODING"] = "utf-8"if home_dir:env["HOME"] = home_dirresult = subprocess.run([sys.executable, "-m", "mem0_cli", *args],capture_output=True,- text=True,+ encoding="utf-8",env=env,timeout=15,)@@ -99,12 +100,13 @@ class TestArgvPreprocessing:result = subprocess.run([sys.executable, "-m", "mem0_cli", "init", "--agent"],capture_output=True,- text=True,+ encoding="utf-8",env={**{k: v for k, v in os.environ.items() if not k.startswith("MEM0_")},"HOME": clean_home,"MEM0_BASE_URL": "http://127.0.0.1:1", # blackhole"FORCE_COLOR": "0",+ "PYTHONIOENCODING": "utf-8",},timeout=15,)@@ -133,12 +135,13 @@ class TestJsonEnvelopeParity:result = subprocess.run([sys.executable, "-m", "mem0_cli", "init", "--agent", "--json"],capture_output=True,- text=True,+ encoding="utf-8",env={**{k: v for k, v in os.environ.items() if not k.startswith("MEM0_")},"HOME": clean_home,"MEM0_BASE_URL": "http://127.0.0.1:1","FORCE_COLOR": "0",+ "PYTHONIOENCODING": "utf-8",},timeout=15,)diff --git a/cli/python/tests/test_cli_integration.py b/cli/python/tests/test_cli_integration.pyindex ea6607201..8abd145d0 100644--- a/cli/python/tests/test_cli_integration.py+++ b/cli/python/tests/test_cli_integration.py@@ -49,6 +49,7 @@ def _run(if key.startswith("MEM0_"):del env[key]env.pop("FORCE_COLOR", None)+ env["PYTHONIOENCODING"] = "utf-8"if home_dir:env["HOME"] = home_dirif env_override:@@ -56,7 +57,7 @@ def _run(result = subprocess.run([sys.executable, "-m", "mem0_cli", *args],capture_output=True,- text=True,+ encoding="utf-8",env=env,)return subprocess.CompletedProcess(diff --git a/cli/python/tests/test_config.py b/cli/python/tests/test_config.pyindex 48db01481..86dc2561b 100644--- a/cli/python/tests/test_config.py+++ b/cli/python/tests/test_config.py@@ -67,7 +67,8 @@ class TestConfig:from mem0_cli.config import CONFIG_FILEmode = os.stat(CONFIG_FILE).st_mode & 0o777- assert mode == 0o600+ if os.name != "nt":+ assert mode == 0o600def test_defaults_save_and_load(self, isolate_config):config = Mem0Config()