NOW RAG is actually usable... might switch to gemma3:4b from glm-4.6 cloud for expenses reasons but we'll see

This commit is contained in:
Renn F
2026-01-03 05:07:45 +01:00
parent 16dda8134b
commit 1d173a5203
76 changed files with 4196 additions and 10668 deletions
+81
View File
@@ -0,0 +1,81 @@
# Testing Standards
## Coverage Target
Minimum 80% code coverage for all modules.
```bash
# Run with coverage
uv run pytest --cov=roboco --cov-report=term-missing
```
## Async Tests
Use pytest-asyncio:
```python
import pytest
@pytest.mark.asyncio
async def test_fetch_user() -> None:
user = await fetch_user("test-123")
assert user.name == "Test User"
```
## Test Structure
Follow AAA pattern: Arrange, Act, Assert.
```python
@pytest.mark.asyncio
async def test_task_claim_success() -> None:
# Arrange
task = await create_test_task(status=TaskStatus.PENDING)
agent = await create_test_agent()
# Act
claimed_task = await task_service.claim(task.id, agent.id)
# Assert
assert claimed_task.status == TaskStatus.CLAIMED
assert claimed_task.assigned_to == agent.id
```
## Test Factories
Use factory-boy for test data:
```python
from factory import Factory, Faker, LazyAttribute
class TaskFactory(Factory):
class Meta:
model = Task
title = Faker('sentence')
status = TaskStatus.PENDING
created_at = LazyAttribute(lambda _: datetime.now(UTC))
```
## Before Submitting to QA
Run full test suite:
```bash
# Backend
uv run pytest
uv run ruff check .
uv run mypy roboco/
# Frontend
pnpm test
pnpm lint
pnpm typecheck
```
## Quality Gates
All tests MUST pass before:
- Submitting for verification
- Creating pull request
- Merging to main