Testing Guide
Environment Setup
Python SDK
cd py
# Install dependencies + dev tools (pytest, pytest-asyncio, pytest-httpx, ruff, mypy)pip install -e ".[dev]"Create py/.env (required only for integration tests):
IMBRACE_API_KEY=api_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxIMBRACE_GATEWAY_URL=https://app-gatewayv2.imbrace.coIMBRACE_ORGANIZATION_ID=org_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxTypeScript SDK
cd tsnpm installPython — Running & Testing
Unit Tests (No API key needed)
cd py
# Run all unit testspytest tests/unit -v
# Run a specific filepytest tests/unit/test_http.py -vpytest tests/unit/resources/test_channel.py -v
# Run a specific test casepytest tests/unit/test_http.py::test_401_raises_auth_error -v
# Run by keywordpytest tests/unit -k "channel" -vpytest tests/unit -k "boards" -vIntegration Tests (Requires real API key)
Integration tests perform real calls to the API Gateway.
cd py
# Option 1: Set key directly in commandIMBRACE_API_KEY=api_xxx pytest tests/integration -v -m integration
# Option 2: Use .env (conftest.py auto-loads it via load_dotenv)pytest tests/integration -v -m integrationRun All (Unit + Integration)
pytest tests/ -vCoverage Report
pytest-covis not included by default. Install it separately:pip install pytest-cov
pytest tests/unit --cov=src/imbrace --cov-report=term-missingTypeScript — Running & Testing
Build
cd ts
# Single buildnpm run build
# Build in watch mode (auto-rebuild on change)npm run dev
# Clean dist/npm run cleanUnit Tests (No API key needed)
cd ts
# Run all unit testsnpm test
# Run a specific filenpx vitest run tests/unit/http.test.tsnpx vitest run tests/unit/resources/contacts.test.ts
# Watch mode (auto-run on code changes)npm run test:watchRun All (Unit + Local Tests)
npm run test:allTypeScript integration tests aren’t available yet — see
py/tests/integration/for live API checks, orts/tests/local/for manual live testing scripts.
Lint & Type Check
Python
cd py
# Check code styleruff check src/ tests/
# Automatically fix fixable ruff errorsruff check src/ tests/ --fix
# Check type annotationsmypy src/imbraceTypeScript
cd ts
# Type checknpm run typecheck
# Lintnpm run lint