mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
fix: resolve test_age_store isolation failure when run with full suite
Evict semantica.graph_store.age_store from sys.modules before importing it with the mocked psycopg2, so the mock takes effect even when other tests have already loaded the semantica package (and cached age_store with its original psycopg2 binding). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
0dbdad35b9
commit
4b1c78372c
@@ -32,6 +32,13 @@ _mock_psycopg2_extras = MagicMock()
|
||||
sys.modules["psycopg2"] = _mock_psycopg2
|
||||
sys.modules["psycopg2.extras"] = _mock_psycopg2_extras
|
||||
|
||||
# Evict any cached import of age_store so it re-imports with our mock psycopg2,
|
||||
# even if other tests already loaded semantica (which would have cached the module
|
||||
# with its original psycopg2 binding, making the sys.modules patch above a no-op).
|
||||
for _key in list(sys.modules.keys()):
|
||||
if "semantica" in _key and "age_store" in _key:
|
||||
del sys.modules[_key]
|
||||
|
||||
from semantica.graph_store.age_store import (
|
||||
ApacheAgeStore,
|
||||
_edge_to_rel_dict,
|
||||
|
||||
Reference in New Issue
Block a user