| name | test |
| description | Run the project test suite. Use when the user says "run tests", "run the tests",
"test this", "make test", "check if tests pass", "pytest", or after completing
code changes that should be verified.
|
| argument-hint | [file-or-pattern] |
Run Tests
Run the project's integration test suite against real services (Postgres, Ollama, AsyncPostgresStore).
How to Run
-
If args are provided, use them as the pytest target:
- A file:
uv run pytest tests/test_memory_routes.py -v
- A pattern:
uv run pytest tests/ -v -k "memory"
- Multiple files:
uv run pytest tests/test_a.py tests/test_b.py -v
-
If no args, run the full suite:
uv run pytest tests/ -v
-
Always use -v for verbose output — the user wants to see every test name and result.
-
Use --timeout 180000 on the Bash call since extraction tests invoke real LLMs and can take 30+ seconds.
Interpreting Results
After the run completes, report:
- Total passed / failed / skipped / errors
- If any tests failed, read the failure output and diagnose the root cause
- If any tests were skipped, explain why based on these common reasons:
| Skip reason | Cause | Fix |
|---|
POSTGRES_URI not set | No Postgres connection available | Start containers: make up |
Ollama not reachable | Ollama embedder can't connect | Start Ollama: ollama serve or check OLLAMA_BASE_URL |
pgvector extension not installed | Postgres missing vector extension | Run CREATE EXTENSION vector in Postgres |
Ollama model not reachable | Extraction model not pulled | The test falls back to OLLAMA_LLM_MODEL from config |
Key Fixtures
These are defined in tests/conftest.py and shared across test files:
pg_pool — Real AsyncConnectionPool to Postgres. Skips if POSTGRES_URI not set.
memory_store — Real AsyncPostgresStore with vector index. Depends on pg_pool + embedder.
embedder — Real OllamaEmbedder. Skips if Ollama is unreachable.
test_user_id — Creates a temporary user row, yields the UUID, deletes it after test.
embed_model_name — Returns the active embedding model name from config.
app_config — Full config dict from get_config().
Guidelines
- This project uses integration tests against real services, not mocks. If writing new tests, always use real Postgres and real Ollama.
asyncio_mode = "auto" is set in pyproject.toml — async test functions are detected automatically without @pytest.mark.asyncio.
- Tests that create data in the store or database must clean up after themselves (delete rows,
adelete store items).
- When a test needs a user, use the
test_user_id fixture — it handles creation and cleanup.
Gotchas
- The containers must be running for integration tests to pass (
make up). If you see connection errors, check Docker first.
AsyncPostgresStore.setup() requires autocommit (CREATE INDEX CONCURRENTLY). The memory_store fixture handles this via create_memory_store() which uses a separate autocommit connection for setup.
- The
memory_extraction tests call a real LLM and take ~5s each. Don't be alarmed by a 25-30s total runtime.
store.asearch(namespace, query="", limit=100) is how we list all items in a namespace — there's no dedicated list method.