Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,15 @@ test-docs: ## Verify docs site builds cleanly
cd site && npx vitepress build docs

.PHONY: test-coverage
test-coverage: ## Run all tests with coverage reports
cd $(BACKEND) && uv run pytest tests/ --tb=short -v
test-coverage: test-coverage-backend test-coverage-frontend ## Run all tests with coverage reports

.PHONY: test-coverage-backend
test-coverage-backend: ## Backend tests with coverage
cd $(BACKEND) && uv run pytest tests/ --cov --cov-report=term-missing --tb=short -v

.PHONY: test-coverage-frontend
test-coverage-frontend: ## Frontend tests with coverage
cd $(FRONTEND) && pnpm test --coverage
cd $(FRONTEND) && pnpm test

# ─── Docker ───────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ See `.env.example` for all options.
## Testing

```bash
make test # Run all tests (149 backend + 29 frontend + docs build)
make test # Run all tests (591 backend + 182 frontend + docs build)
make test-backend # Backend tests only
make test-frontend # Frontend tests only
make test-docs # Docs build check
Expand Down
12 changes: 12 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ openmlr = "openmlr.main:main"
dev-dependencies = [
"pytest>=8.0.0",
"pytest-asyncio>=0.24.0",
"pytest-cov>=6.0.0",
"aiosqlite>=0.20.0",
"httpx>=0.28.0",
]

[tool.coverage.run]
source = ["openmlr"]
omit = ["openmlr/db/migrations/*"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if __name__ == .__main__.:",
"raise NotImplementedError",
]
4 changes: 4 additions & 0 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,15 @@ async def client() -> AsyncGenerator[httpx.AsyncClient, None]:
from openmlr.app import app
from openmlr.db.engine import get_db as engine_get_db
from openmlr.dependencies import get_db as dep_get_db
from openmlr.config import AgentConfig

# Override both the canonical get_db *and* the re-export in dependencies
app.dependency_overrides[engine_get_db] = _override_get_db
app.dependency_overrides[dep_get_db] = _override_get_db

# Set minimal app state since lifespan is skipped
app.state.config = AgentConfig()

transport = httpx.ASGITransport(app=app)
async with httpx.AsyncClient(
transport=transport,
Expand Down
Loading
Loading