claude-os/tests
Bob Roberts ee7b62bc5b
All checks were successful
Tests / test (push) Successful in 13m33s
feat: Add cross-KB search, inline health checks, and simplify templates
- Add search_all_knowledge_bases MCP tool + POST /api/kb/search-all endpoint
  + query_documents_multi_kb() in sqlite_manager with dedup and score merge
- Add inline health check to search_knowledge_base (24h cache, appends warnings)
- Rewrite CLAUDE.md template: 351→128 lines, project content first, session tips
- Simplify session command: 625→224 lines, 4-field state file
- Update README.md What's New to v2.5, remove Discord section
- Add cross-KB search tool to CLAUDE.md MCP tools table
- Add 5 new tests for query_documents_multi_kb (all 593 tests pass)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 11:04:21 -06:00
..
__init__.py Almost got the mosnter finished 2025-10-27 17:41:44 -05:00
conftest.py Code cleanup still and all tests passing now 2025-12-02 15:28:25 -06:00
README.md Project cleanup 2025-10-31 16:54:28 -05:00
test_agent_os.py Major cleanup that should have done before announcing this app!!! 2025-12-02 14:35:15 -06:00
test_api.py Code cleanup still and all tests passing now 2025-12-02 15:28:25 -06:00
test_auth.py Adding more tests to improve test coverage 2025-12-11 14:07:58 -06:00
test_config.py test(core): Fix test suite and improve core configuration 2025-10-27 21:52:46 -05:00
test_conversation_watcher.py Code cleanup still and all tests passing now 2025-12-02 15:28:25 -06:00
TEST_COVERAGE.md 🗂️ ORGANIZE: Reorganize root directory structure 2025-11-04 21:34:26 +00:00
test_embeddings.py mostly working correctly 2025-10-24 16:17:47 -05:00
test_health.py Code cleanup still and all tests passing now 2025-12-02 15:28:25 -06:00
test_hooks.py Code cleanup still and all tests passing now 2025-12-02 15:28:25 -06:00
test_ingestion.py Adding more tests to improve test coverage 2025-12-11 14:07:58 -06:00
test_insight_extractor.py Adding more tests to improve test coverage 2025-12-11 14:07:58 -06:00
test_kb_metadata.py Code cleanup still and all tests passing now 2025-12-02 15:28:25 -06:00
test_knowledge_lifecycle.py feat: Add Knowledge Lifecycle Engine and fix upload_document MCP tool 2026-02-06 10:08:00 -06:00
test_learning_jobs.py Code cleanup still and all tests passing now 2025-12-02 15:28:25 -06:00
test_markdown_preprocessor.py Code cleanup still and all tests passing now 2025-12-02 15:28:25 -06:00
test_mcp_server.py Add non-blocking semantic indexing with Jobs Dashboard UI 2025-12-08 17:19:15 -05:00
test_rag_engine.py Code cleanup still and all tests passing now 2025-12-02 15:28:25 -06:00
test_rag_engine_full.py Adding more tests to improve test coverage 2025-12-11 14:07:58 -06:00
test_redis_config.py Code cleanup still and all tests passing now 2025-12-02 15:28:25 -06:00
test_session_parser.py feat: Add Skills Library and Session Insights (v2.3) 2025-12-11 12:56:49 -06:00
test_skill_manager.py Adding more tests to improve test coverage 2025-12-11 14:07:58 -06:00
test_spec_tracking.py Major cleanup that should have done before announcing this app!!! 2025-12-02 14:35:15 -06:00
test_sqlite_manager.py feat: Add cross-KB search, inline health checks, and simplify templates 2026-02-06 11:04:21 -06:00
TESTING_GUIDE.md 🗂️ ORGANIZE: Reorganize root directory structure 2025-11-04 21:34:26 +00:00

Claude OS Test Suite

Comprehensive tests for the Claude OS RAG system.

Setup

  1. Install test dependencies:

    pip install -r requirements.txt
    
  2. Set environment variables (optional):

    export TEST_OLLAMA_HOST=http://localhost:11434
    

    Note: Tests use SQLite database which is automatically created in the test environment.

Running Tests

Run all tests:

pytest

Run specific test categories:

# Unit tests only (fast, no external dependencies)
pytest -m unit

# Integration tests (require database, Ollama)
pytest -m integration

# Vector operation tests
pytest -m vector

# RAG engine tests
pytest -m rag

# API endpoint tests
pytest -m api

Run specific test files:

pytest tests/test_pg_vector.py
pytest tests/test_rag_engine.py
pytest tests/test_api.py

Run with coverage:

pytest --cov=app --cov-report=html
# Open htmlcov/index.html to view coverage report

Run with verbose output:

pytest -v

Run and stop on first failure:

pytest -x

Test Structure

  • conftest.py - Shared fixtures and configuration
  • test_rag_engine.py - RAG engine functionality
  • test_embeddings.py - Embedding generation
  • test_document_processing.py - Document ingestion and chunking
  • test_api.py - FastAPI endpoints

Test Markers

Tests are categorized with markers:

  • @pytest.mark.unit - Fast unit tests, no external dependencies
  • @pytest.mark.integration - Integration tests requiring database/Ollama
  • @pytest.mark.slow - Tests that may take several seconds
  • @pytest.mark.embeddings - Tests involving embedding generation
  • @pytest.mark.vector - Tests involving vector operations
  • @pytest.mark.rag - Tests involving RAG engine
  • @pytest.mark.api - Tests involving API endpoints

Fixtures

Common fixtures available in all tests:

  • test_db_config - Database configuration
  • db_connection - Test database connection (session-scoped)
  • clean_db - Clean database before each test
  • sample_kb - Sample knowledge base
  • sample_embedding - Sample 768-dimensional embedding
  • sample_documents - Sample documents with embeddings
  • mock_ollama_embedding - Mock Ollama embedding model
  • mock_ollama_llm - Mock Ollama LLM
  • sample_text_file - Sample text file
  • sample_pdf_file - Sample PDF file
  • sample_markdown_file - Sample Markdown file
  • api_client - FastAPI test client

CI/CD Integration

Tests can be run in CI/CD pipelines:

# Example GitHub Actions workflow
- name: Run tests
  run: |
    pytest --cov=app --cov-report=xml
    
- name: Upload coverage
  uses: codecov/codecov-action@v3

Troubleshooting

Ollama connection errors:

  • Ensure Ollama is running: curl http://localhost:11434/api/tags
  • Check TEST_OLLAMA_HOST environment variable

Import errors:

  • Ensure you're in the project root directory
  • Install all dependencies: pip install -r requirements.txt