3094c0bd10
TDD: test first, failed, fixed, passed. Igor fixed query_relationship/timeline/stats in an earlier commit. close() was the last method touching self._connection without holding the lock. Closes #883. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
14 lines
415 B
Python
14 lines
415 B
Python
"""TDD: KnowledgeGraph.close() must hold self._lock."""
|
|
|
|
import inspect
|
|
from mempalace.knowledge_graph import KnowledgeGraph
|
|
|
|
|
|
class TestKGCloseLock:
|
|
def test_close_holds_lock(self):
|
|
src = inspect.getsource(KnowledgeGraph.close)
|
|
assert "self._lock" in src, (
|
|
"close() does not acquire self._lock. "
|
|
"Closing while a read/write is in progress can corrupt data."
|
|
)
|