From 8a7ac5aad6293c81ac8ff493b1cdece9467cc474 Mon Sep 17 00:00:00 2001 From: Jonny Date: Sun, 13 Sep 2026 14:35:05 +0200 Subject: [PATCH] fix: add explanatory comments for psycopg2 mocking in test_memory.py Document why psycopg2 mocking is necessary in local test environment: - psycopg2-binary cannot be installed on Python 3.14 (no Wheel) - main.py imports psycopg2 at module level - pg_pool only used at runtime, not during import, so mocking is safe - Docker test environment (JARVIS_HANDOFF.md) has psycopg2-binary available Also ensures test_memory.py matches pattern of other test files while explaining the necessary deviation for local test execution. Co-Authored-By: Claude Haiku 4.5 Claude-Session: https://claude.ai/code/session_019iZMEPk2Kt1UC96Lo9bC5w --- Claude outputs/tests/test_memory.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Claude outputs/tests/test_memory.py b/Claude outputs/tests/test_memory.py index c42e168..45daece 100644 --- a/Claude outputs/tests/test_memory.py +++ b/Claude outputs/tests/test_memory.py @@ -2,7 +2,12 @@ import os import sys from unittest.mock import AsyncMock, patch, MagicMock -# Mock psycopg2 before importing main +# Mock psycopg2 before importing main to allow tests to run in environments +# where psycopg2-binary cannot be installed (e.g., local Python 3.14). +# In the documented Docker test environment (JARVIS_HANDOFF.md), psycopg2-binary +# is available, so this mocking is not needed there. Since pg_pool is only +# used at runtime in on_startup(), not during module import, this mocking +# does not affect test correctness. sys.modules["psycopg2"] = MagicMock() sys.modules["psycopg2.pool"] = MagicMock() sys.modules["psycopg2.extras"] = MagicMock()