Files
mempalace/tests/test_miner.py
T
bensig 0f8fa8c7d5 bench: add benchmark runners, results docs, and test suite
Benchmarks: LongMemEval, LoCoMo, ConvoMem, MemBench runners with
methodology docs and hybrid retrieval analysis.

Tests: config, miner, convo_miner, normalize — 9 tests, all passing.
2026-04-04 18:33:42 -07:00

37 lines
1012 B
Python

import os
import tempfile
import shutil
import yaml
import chromadb
from mempalace.miner import mine
def test_project_mining():
tmpdir = tempfile.mkdtemp()
# Create a mini project
os.makedirs(os.path.join(tmpdir, "backend"))
with open(os.path.join(tmpdir, "backend", "app.py"), "w") as f:
f.write("def main():\n print('hello world')\n" * 20)
# Create config
with open(os.path.join(tmpdir, "mempalace.yaml"), "w") as f:
yaml.dump(
{
"wing": "test_project",
"rooms": [
{"name": "backend", "description": "Backend code"},
{"name": "general", "description": "General"},
],
},
f,
)
palace_path = os.path.join(tmpdir, "palace")
mine(tmpdir, palace_path)
# Verify
client = chromadb.PersistentClient(path=palace_path)
col = client.get_collection("mempalace_drawers")
assert col.count() > 0
shutil.rmtree(tmpdir)