Testing
CleverThis uses nox as the test runner for all Python code. JavaScript/TypeScript tests use Vitest via pnpm. Run tests before opening a pull request — the CI pipeline runs the same commands.
Python tests (nox)
List all available nox sessions:
nox -l
Key sessions:
| Session | Command | What it runs |
|---|---|---|
test | nox -s test | Full pytest suite (server + cleveractors-core) |
test-api | nox -s test-api | API server tests only |
test-actors | nox -s test-actors | cleveractors-core tests only |
lint | nox -s lint | ruff check + ruff format --check |
typecheck | nox -s typecheck | mypy type checking |
migrate | nox -s migrate | Run Alembic migrations against the dev DB |
Run a specific test file:
nox -s test -- tests/server/test_chat.py
Run with coverage:
nox -s test -- --cov --cov-report=html
JavaScript tests (Vitest)
pnpm test # run all tests
pnpm test:watch # watch mode
pnpm test:coverage # with coverage report
Integration tests
Integration tests start a real local stack (API server + test database) and exercise the full request flow. They are tagged with @pytest.mark.integration and are excluded from the fast unit test runs. Run them with:
nox -s test-integration
Integration tests require Docker (for the test database). They run in CI on every PR but are slower locally.
Coming soon
End-to-end (Playwright) tests for the webapp and Actor execution snapshot tests are being added.