Running tests
Test markers
| Marker | What it means | API keys needed |
|---|---|---|
| (none / unit) | Fast unit tests | No |
integration | Uses VCR cassettes for HTTP replay | No (uses fake keys) |
slow | Real API calls against live services | Yes |
VCR cassette system
VCR cassettes record and replay HTTP interactions so integration tests run without live API access. This is the primary mechanism for testing agent behavior end-to-end.Where cassettes live
Replay mode (default, CI)
No API keys needed. The_fake_api_keys fixture injects placeholder keys so the HTTP client constructs valid-looking requests, and VCR intercepts them before they reach the network.
Record mode
To record new cassettes or re-record existing ones, run with real API keys set in your environment:- API keys and authorization headers
- Base64-encoded binary blobs
- OpenAI reasoning content
When to record
- You add a new integration test that makes HTTP calls
- An upstream API changes its response format
- You modify agent behavior that changes the request sequence
Async tests
asyncio_mode = "auto" is set in pyproject.toml. All async def test_* functions run automatically without the @pytest.mark.asyncio decorator.
unittest.IsolatedAsyncioTestCase:
Writing a new test
Follow this checklist:- Place unit tests in
tests/unit/<module>/mirroring thesrc/motus/structure. - Place integration tests in
tests/integration/. - If your test makes HTTP calls, record a VCR cassette and commit it with your PR.
- If your test uses the runtime, call
shutdown()in teardown to avoid leaked tasks. - Name test files with the
test_prefix (e.g.,test_agent_task.py). - Name test functions with the
test_prefix describing the behavior under test.

