From patriotforge
Use when writing tests, setting up test fixtures, mocking dependencies, or following test-driven development — pytest-asyncio, fakeredis, httpx, and test organization patterns.
npx claudepluginhub aka-kolton/patriotforge-claude-plugin --plugin patriotforgeThis skill uses the workspace's default tool permissions.
**Philosophy:** Tests first, implementation follows. Every service function and endpoint gets tests before code.
Implements Clean Architecture in Android and Kotlin Multiplatform projects: module layouts, dependency rules, UseCases, Repositories, domain models, and data layers with Room, SQLDelight, Ktor.
Enforces code quality on file edits via Plankton hooks: auto-formats, lints, Claude-powered fixes with model tiering, config protection, and legacy package manager blocks.
Enforces C++ Core Guidelines for writing, reviewing, and refactoring modern C++ code (C++17+), promoting RAII, immutability, type safety, and idiomatic practices.
Philosophy: Tests first, implementation follows. Every service function and endpoint gets tests before code.
Stack: pytest-asyncio (auto mode) · fakeredis · aiosqlite · httpx AsyncClient
# conftest.py — shared fixtures cascade top-down:
test_settings() # → Settings with SQLite + fakeredis + short timeouts
test_engine() # → async SQLAlchemy engine (in-memory SQLite)
test_db_session() # → async session factory, creates tables per-test
test_redis() # → FakeRedis (async), flushed per-test
app(settings, session_factory, redis) # → FastAPI app with test state injected
client(app) # → httpx.AsyncClient with ASGI transport
Key: The app fixture injects test dependencies via app.state, so no monkeypatching is needed.
backend/tests/
├── conftest.py # shared fixtures + helpers
├── test_auth_service.py # unit tests — service layer
├── test_auth_api.py # integration tests — full HTTP
├── test_quotes_service.py
├── test_quotes_api.py
└── ...
test_<module>_service.py — tests service functions directly (no HTTP)test_<module>_api.py — tests endpoints via client (full request/response)class TestPasswordHashing:
"""Tests for hash_password() and verify_password()."""
async def test_hashes_are_salted(self, test_settings):
...
async def test_rejects_short_passwords(self, test_settings):
...
# In conftest.py — reusable across test files:
async def register_user(client, **overrides) -> httpx.Response:
payload = {"email": "test@example.com", "password": "SecurePass123!", ...}
payload.update(overrides)
return await client.post("/api/auth/register", json=payload)
async def login_user(client, email, password) -> httpx.Response:
return await client.post("/api/auth/login", json={...})
📖 Reference: backend/tests/conftest.py, backend/tests/test_auth_service.py, backend/tests/test_auth_api.py