test

A project-specific guide for running and understanding backend and frontend tests. It covers pytest tests using a real PostgreSQL database and Vitest tests for frontend code.

In plain words
What is it for?
Use it to run all or selected tests, measure coverage, debug failures, and understand the database and request setup used by the tests.
Why use it?
It helps developers run the right tests, investigate failures, and check which code is not covered by tests.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/benja-pauls/serpentstack/test
Any agent
npx skills add Benja-Pauls/SerpentStack --skill test
Clone the repo
git clone --depth 1 https://github.com/Benja-Pauls/SerpentStack

Made for: Claude Code, Codex.

Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,195 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00048 $0.01195
Opus 5 $0.00024 $0.00598
Sonnet 5 $0.00010 $0.00239
Haiku 4.5 $0.00005 $0.00120

Measured 2d ago against content hash 41bf941c95c6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.skills/test/SKILL.md · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Test

Run and interpret tests for SerpentStack backend and frontend.

Backend Tests (pytest)

Run All Tests

cd backend && uv run pytest

Run a Specific File

cd backend && uv run pytest tests/test_health.py

Run a Specific Test

cd backend && uv run pytest tests/test_health.py::test_health_check -v

Run with Coverage

cd backend && uv run pytest --cov=app --cov-report=term-missing

Look at the Miss column to find lines without test coverage.

Test Infrastructure

Tests use a real PostgreSQL instance via testcontainers — a Docker container is spun up automatically per test session. This ensures tests exercise the same database features (UUID columns, JSONB, ON CONFLICT) used in production.

Each test gets an AsyncSession bound to an outer transaction with join_transaction_mode="create_savepoint". This means when route handlers call await db.commit(), SQLAlchemy commits a savepoint — not the real transaction. The fixture rolls back the outer transaction after each test, keeping tests fully isolated. The async httpx.AsyncClient uses dependency_overrides to inject this test session.

Requirement: Docker must be running for tests to pass.

Interpreting pytest Output

  • PASSED: test is green, no action needed.
  • FAILED: look for the FAILED summary line, then scroll up to the full assertion error.
  • ERROR: a fixture or setup function raised an exception -- not a test logic failure but an infrastructure issue.

When a test fails:

  1. Read the AssertionError message. It shows expected vs actual values.
  2. Read the test function to understand what it asserts.
  3. Read the source code being tested to understand the actual behavior.
  4. Determine if the test is wrong (update the test) or the source is wrong (fix the source).
  5. Re-run the specific test to confirm the fix: uv run pytest <path>::<test_name> -v.

Common pytest Failures

Pattern Meaning Action
AssertionError: assert 200 == 422 Endpoint validation rejected the request Check request payload against Pydantic schema
sqlalchemy.exc.ProgrammingError Missing table or column Run uv run alembic upgrade head
fixture 'X' not found Missing or misnamed test fixture Check conftest.py files
assert 'items' in data fails Response shape changed Check if endpoint returns a wrapper object ({Name}ListResponse)
ConnectionRefusedError or container timeout Docker is not running Start Docker Desktop, then re-run tests
docker.errors.DockerException Docker daemon unreachable Check docker ps works, restart Docker if needed
RuntimeError: no running event loop asyncio_mode not set or test not async def Verify asyncio_mode = "auto" in pyproject.toml — do NOT add @pytest.mark.asyncio (it's redundant with auto mode)
MissingGreenlet / await in sync context Accidentally called sync code in async path Ensure all DB operations use await with AsyncSession

Read the full file on GitHub · 134 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 134 lines · 48 tokens per session scan A 41bf941c95c6

Subscribe to this mod's changes

test is a skill published in the GitHub repository Benja-Pauls/SerpentStack (2 stars, last pushed 5mo ago), licensed MIT. It adds 48 tokens to every session and 1,195 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

agent-host-chat-contributions

Build and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context injection, restored-history transformation, protocol-action observation, or when reviewing changes that add code to AgentSideEffects or AgentService.

microsoft/vscode · 56 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens