personal memory agent
solstone docs testing.md
2.2 kB
Markdown
at commit bd588dc6

Testing #

Test Structure #

  • Framework: pytest; coverage reporting comes from make test-cov, make ci, or make coverage, not bare make test
  • Unit Tests: live under tests/ (and each app's tests/ dir)
    • Fast, no external API calls, no real browser
    • Use tests/fixtures/journal/ mock data
    • Test individual functions and modules
  • Naming: Files test_*.py, functions test_*
  • Fixtures: Shared fixtures in tests/conftest.py

Fixture Journal #

# The autouse set_test_journal_path fixture in tests/conftest.py does this
# for unit tests. Set it explicitly only when a test needs a different journal.
os.environ["SOLSTONE_JOURNAL"] = "tests/fixtures/journal"
# Now all journal operations work with test data

The tests/fixtures/journal/ directory contains a complete mock journal structure with sample facets, agents, transcripts, and indexed data for testing.

Running Tests #

  • make test runs all unit tests — tests/ + every solstone/apps/*/tests/, in one parallel run
  • make test-cov — the same suite with coverage reporting
  • make test-app APP=<name> to run a single app's tests; make test-only TEST=path for a specific file/pattern
  • make coverage to generate a coverage report
  • make ci before committing (formats, lints, tests)
  • Always run journal restart-convey after editing solstone/convey/ or solstone/apps/ to reload code

Worktree Development #

Run the full stack (supervisor + callosum + sense + cortex + convey) against test fixture data:

make dev                    # Start stack (Ctrl+C to stop)

In a second terminal, hit endpoints:

export SOLSTONE_JOURNAL=tests/fixtures/journal
export PATH=$(pwd)/.venv/bin:$PATH
curl -s http://localhost:$(cat tests/fixtures/journal/health/convey.port)/

Notes:

  • Agents won't execute without API keys — this is expected in worktrees
  • Output artifacts go in scratch/ (git-ignored)
  • Service logs: tests/fixtures/journal/health/<service>.log
  • make dev writes runtime artifacts (stats cache, health logs, task logs) into the fixtures journal — these are covered by tests/fixtures/journal/.gitignore and should never be committed