ODAI ships with a comprehensive test suite: 700+ tests across 67 test files, achieving 90%+ code coverage across all tested modules. Tests are run via a customDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sibblegp/ODAI/llms.txt
Use this file to discover all available pages before exploring further.
run_tests.py runner built on top of pytest, with support for parallel execution, coverage reporting, and file-level filtering.
Install test dependencies
| Package | Purpose |
|---|---|
pytest | Test framework |
pytest-asyncio | Async test support (asyncio_mode = auto) |
pytest-mock | Enhanced mocking utilities |
pytest-cov | Coverage reporting |
pytest-xdist | Parallel test execution (-n flag) |
pytest-timeout | Per-test timeout enforcement (10s default) |
httpx | HTTP client for FastAPI endpoint testing |
Running tests
Using the test runner (recommended)
run_tests.py is the primary way to run tests. It auto-detects virtual environments, sets PYTHONPATH, and suppresses noisy warnings.
Test runner flags
| Flag | Short | Description |
|---|---|---|
--file <name> | -f | Run only tests/test_<name>.py |
--coverage | -c | Generate an HTML and terminal coverage report in htmlcov/ |
--verbose | -v | Pass -v to pytest for per-test output |
--workers <n> | -w | Run tests in parallel with n workers via pytest-xdist |
--fast | Skip tests marked @pytest.mark.slow | |
--open | Open htmlcov/index.html in the browser after coverage runs | |
--install-deps | Run pip install -r test_requirements.txt before executing |
Direct pytest commands
You can also use pytest directly for more granular control:Test categories
Tests are organized into six categories, all living in thetests/ directory:
Unit tests
Test individual methods in complete isolation with all external dependencies mocked (OpenAI, Firebase, Google Cloud, third-party APIs). These make up the majority of the suite and run fast.Integration tests
Validate interactions between components — for example, end-to-end authentication flows, chat session creation through the service and data layers, or complete WebSocket lifecycle management.E2E tests
Full user-journey scenarios exercising the API, service, integration, and data layers together.WebSocket tests
Real-time connection and streaming tests covering theConnectionManager and WebSocketHandler classes. The ConnectionManager achieves 100% coverage.
Authentication tests
OAuth flow and token validation tests forAuthService, covering Firebase ID token validation, WebSocket authentication, HTTP request authentication, and Google OAuth 2.0.
Connector tests
Each third-party integration (Plaid, Gmail, FlightAware, Yelp, etc.) is tested independently with mocked HTTP responses.The @pytest.mark.slow marker
Tests that interact with real external services or have long execution times are marked with @pytest.mark.slow. These are skipped when you want a quick feedback loop:
Parallel execution
The deploy scripts run tests with--workers 8 before every deployment. You can tune this based on your machine:
Parallel execution via
pytest-xdist requires tests to be properly isolated. All tests in this suite mock external dependencies, so parallel runs are safe by default.Coverage reports
Running with--coverage produces both a terminal summary and an HTML report:
htmlcov/index.html to browse coverage by file. Use --open to launch it automatically:
Current coverage targets
| Module | Coverage |
|---|---|
services/auth_service.py | 84% |
services/chat_service.py | 97% |
websocket/connection_manager.py | 100% |
websocket/handlers.py | 96% |
firebase/models/* | High across all models |
connectors/utils/* | High across all utilities |
| Overall | 90%+ |
pytest configuration
Thepytest.ini in the project root configures the test environment:
--timeout=10— each test is killed after 10 seconds to prevent hangs--strict-markers— unregistered markers cause an error, keeping the marker list cleanasyncio_mode = auto— allasync deftest functions are automatically treated as async tests without needing@pytest.mark.asyncio--tb=short— concise traceback format for faster scanning of failures