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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019iZMEPk2Kt1UC96Lo9bC5w
This commit is contained in:
parent
affb97474c
commit
8a7ac5aad6
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue