Testing

Test suite guide — 1,234 tests across the engine, clients, API, crypto tools, memory, lookouts, and more

Running Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run all tests
pytest

# Run with verbose output
pytest -v

# Run a specific test file
pytest tests/test_api.py

# Run tests matching a pattern
pytest -k "test_research"

Test Files

FileCoverage
test_api.pyAPI endpoint tests (health, research, search, results, export)
test_api_new.pyAdditional API tests (templates, steering, sessions, compare)
test_charts.pyData visualization extraction and rendering
test_config.pySettings and environment variable loading
test_conflict_detection.pyConflict detection between sources
test_crypto_research.pyCrypto research tools and modes
test_db.pyDatabase operations (results, sessions, lookouts, memory)
test_export.pyPDF, HTML, and Markdown export
test_lookouts.pyScheduled research and change detection
test_memory.pyKnowledge base — memorize, recall, compare
test_models.pyPydantic model validation
test_prompts.pyPrompt template generation
test_research_engine.pyResearch engine — planning, agent loop, recursive search, synthesis
test_scheduler.pyLookout scheduler lifecycle
test_structured_output.pyJSON Schema structured output extraction
test_visualization.pyChart data extraction and spec generation

Client Tests

tests/test_clients/
├── test_browse.py        # URL content extraction
├── test_crypto.py        # CoinGecko, DeFi Llama clients
├── test_exa.py           # Exa search client
├── test_github.py        # GitHub search and code search
├── test_media.py         # YouTube search and transcription
├── test_x_search.py      # X/Twitter search via xAI
└── ...

End-to-End Tests

tests/e2e/
└── ...                   # Full pipeline integration tests

Test Architecture

Tests use pytest with pytest-asyncio for async tests. Key patterns:

  • Mocked LLM calls — all litellm calls are mocked to avoid API costs
  • Mocked HTTP clients — external API calls (Exa, CoinGecko, etc.) are mocked
  • In-memory database — database tests use a test PostgreSQL or mock the db module
  • FastAPI TestClient — API tests use Starlette's TestClient for synchronous HTTP testing

Running Specific Categories

# API tests only
pytest tests/test_api.py tests/test_api_new.py -v

# Crypto tests only
pytest tests/test_crypto_research.py tests/test_clients/test_crypto.py -v

# Research engine
pytest tests/test_research_engine.py -v

# Memory and knowledge base
pytest tests/test_memory.py -v

# Export formats
pytest tests/test_export.py -v

Coverage

pytest --cov=app --cov-report=html
open htmlcov/index.html

On this page