Testing Guide
Test Types in This Repository
- Unit tests for phrase/runtime/journal behavior
- Dispatch behavior tests for distributed routing and fallback
- Retry policy and recovery behavior tests
- FastAPI lifecycle and integration behavior tests
- Conversation tests in worker modules for orchestration validation
Conversation Testing
Conversation tests are decorated with @lang.conversation and receive a Moderator.
Pattern:
- build phrase
- dispatch with
mod.say(...) - assert intermediate status/result behavior
Use echo(...) to stub expensive or external steps while preserving orchestration flow.
What to Verify When Adding Features
- status transitions (
pending -> running -> completed/failed/...) - emitted event timeline consistency
- serialization/deserialization for new payload types
- queue selection and routing behavior
- retry and backoff semantics
Suggested Test Commands
pytest -q
lingo test examples/fastapi/worker1.py examples/fastapi/worker2.py