Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

fix: resolve test_age_store isolation failure when run with full suite (#357)

Mohd Kaif501142e8dec1
diff --git a/tests/graph_store/test_age_store.py b/tests/graph_store/test_age_store.py
index 16fda47b..3d32d1d0 100644
--- a/tests/graph_store/test_age_store.py
+++ b/tests/graph_store/test_age_store.py
@@ -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,