| name | chappie-testing |
| description | CHAPPiE testing strategy. Use when writing or running tests, CI/CD, or validating changes before push. |
CHAPPiE Testing Strategy
Test Types (from safest to most expensive)
| Type | Location | Cost | Examples |
|---|
| py_compile | inline | zero | python3 -m py_compile <file> |
| Quick tests | tests/test_quick.py | zero (no API) | imports, agents, forgetting curve |
| Unit tests | tests/test_*.py | zero | logic, parsing, formatting |
| API contract | tests/test_api_contract.py | zero (mocked) | endpoint validation |
| Frontend build | cd frontend && npm run build | npm only | TypeScript + Vite |
| Live tests | tests/test_brain_agents.py | needs model | use sparingly |
Running Safe Tests (no model loading)
python3 -m py_compile api/main.py api/routers/*.py web_infrastructure/backend_wrapper.py brain/vllm_brain.py config/config.py config/prompts.py
python3 tests/test_quick.py
python3 tests/test_repetition_penalty.py
python3 tests/test_reasoning_layering.py
python3 tests/test_forgetting_curve.py
python3 tests/test_chat_ui_formatting.py
python3 tests/test_training_config_ui.py
Mocking Dependencies for Tests
import sys
from unittest.mock import MagicMock, patch
for mod in ("ollama", "chromadb", "chromadb.config", "requests", "openai"):
if mod not in sys.modules:
sys.modules[mod] = MagicMock()
from brain.base_brain import GenerationConfig
from brain.vllm_brain import VLLMBrain
Pre-Commit Checklist
py_compile all modified Python files
- Run at least the quick test suite
- Frontend build for any TSX changes
- Check no secrets in diff (
CHAPPIE_CONFIG.json, config/secrets.py)
- Review git log for commit style
Known Test Issues
- Many tests need
ollama, chromadb, openai installiert
brain/__init__.py imports ALL brain impls → mock before import
memory/__init__.py imports MemoryEngine → needs chromadb
- Frontend has broken import:
../lib/format (fixed — created format.ts)