abd52534bb
- Add tests for config, convo_miner, spellcheck, knowledge_graph - Fix Windows PermissionError in test cleanup (chromadb file locks) - Add UTF-8 encoding to split_mega_files, entity_registry, hooks_cli - Fix mcp_server parse_known_args logging for unknown args - Set coverage threshold to 85 in pyproject.toml and CI - Reset all version files to 3.0.11 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
842 B
Python
27 lines
842 B
Python
import os
|
|
import tempfile
|
|
import shutil
|
|
import chromadb
|
|
from mempalace.convo_miner import mine_convos
|
|
|
|
|
|
def test_convo_mining():
|
|
tmpdir = tempfile.mkdtemp()
|
|
with open(os.path.join(tmpdir, "chat.txt"), "w") as f:
|
|
f.write(
|
|
"> What is memory?\nMemory is persistence.\n\n> Why does it matter?\nIt enables continuity.\n\n> How do we build it?\nWith structured storage.\n"
|
|
)
|
|
|
|
palace_path = os.path.join(tmpdir, "palace")
|
|
mine_convos(tmpdir, palace_path, wing="test_convos")
|
|
|
|
client = chromadb.PersistentClient(path=palace_path)
|
|
col = client.get_collection("mempalace_drawers")
|
|
assert col.count() >= 2
|
|
|
|
# Verify search works
|
|
results = col.query(query_texts=["memory persistence"], n_results=1)
|
|
assert len(results["documents"][0]) > 0
|
|
|
|
shutil.rmtree(tmpdir, ignore_errors=True)
|