pytest-databases

pytest-databases is a skill for Claude Code from litestar-org/litestar-skills. It costs 79 tokens per session (1,694 once invoked), scanned A, original, MIT.

A set of database fixtures for pytest, Python’s testing framework, that starts database services in containers for tests. It supports several databases and related services, rather than mocked databases.

In plain words
What is it for?
Testing applications that use PostgreSQL, MySQL, MongoDB, Redis, Elasticsearch, BigQuery, cloud-storage emulators, and other supported services.
Why use it?
It gives tests real, isolated database services instead of requiring each developer or test environment to configure them manually.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the litestar plugin — 31 skills, 1 agent, 1 hook shipped together

Good fit Testing applications that use PostgreSQL, MySQL, MongoDB, Redis, Elasticsearch, BigQuery, cloud-storage emulators, and other supported services.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/litestar-org/litestar-skills/pytest-databases
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.

Any agent
npx skills add litestar-org/litestar-skills --skill pytest-databases
Clone the repo
git clone --depth 1 https://github.com/litestar-org/litestar-skills

Made for: Claude Code.

Or install litestar, the plugin that ships this one along with the rest of its 31 skills, 1 agent, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pytest-databases

README.md
[![agentmods](https://agentmods.dev/badge/skills/litestar-org/litestar-skills/pytest-databases/github.svg)](https://agentmods.dev/skills/litestar-org/litestar-skills/pytest-databases)
Your own site
<a href="https://agentmods.dev/skills/litestar-org/litestar-skills/pytest-databases"><img src="https://agentmods.dev/badge/skills/litestar-org/litestar-skills/pytest-databases/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pytest-databases

Your own site · 80×15
<a href="https://agentmods.dev/skills/litestar-org/litestar-skills/pytest-databases"><img src="https://agentmods.dev/badge/skills/litestar-org/litestar-skills/pytest-databases.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 79 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,694 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00079 $0.01694
Opus 5 $0.00039 $0.00847
Sonnet 5 $0.00016 $0.00339
Haiku 4.5 $0.00008 $0.00169

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

Security

Grade A, and why

pytest-databases 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 9d 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.

plugins/litestar/skills/pytest-databases/SKILL.md · 176 lines

How it starts

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

pytest-databases

pytest-databases provides session-scoped, container-backed service fixtures. This guidance targets the immutable v0.19.0 tag. Load only the plugin modules the test suite uses. Consume a ready client fixture where one exists; otherwise connect with the client already used by the project.

Code Style Rules

  • Keep database I/O consistent with the project driver. The package's PostgreSQL connection fixtures use synchronous psycopg; do not await their methods.
  • Type service fixtures with the service class from the same plugin module.
  • Prefer ready client fixtures when provided. For service-only plugins, build the project's existing client from the service object's host, port, and credentials.
  • Keep plugin declarations in the nearest conftest.py; do not load every backend globally.

Quick Reference

Install and enable

pip install "pytest-databases[postgres]"
# conftest.py
pytest_plugins = ["pytest_databases.docker.postgres"]

The core pytest_databases pytest entry point supplies docker_client and docker_service. Each database module supplies its own fixtures.

Choose the fixture shape

Need Use
A ready psycopg connection postgres_connection, a versioned PostgreSQL-family connection, or cockroachdb_connection
A ready vendor client bigquery_client, spanner_connection, mongodb_connection, an Oracle connection, a GizmoSQL connection, or an Azure Blob container client
Service coordinates for the project's own client The backend's *_service fixture
A specific PostgreSQL-family release Matching *_NN_service, *_NN_connection, and *_NN_port fixtures
Parallel worker isolation The backend's exact *_xdist_isolation_level fixture from xdist.md

See reference.md for the exact plugin, service, and ready-client matrix. Do not infer a *_connection fixture from a *_service fixture's name.

Read the full file on GitHub · 176 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 9d ago First seen · 176 lines · 79 tokens per session scan A 2d5d94f7ab3b

Subscribe to this mod's changes

pytest-databases is a skill published in the GitHub repository litestar-org/litestar-skills (14 stars, last pushed 19d ago), licensed MIT. It adds 79 tokens to every session and 1,694 once invoked, about $0.0004 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-30.

Related

Other skills, from other repositories

ecto-patterns

Ecto patterns — schemas, changesets, queries, migrations, Multi, associations, preloads, upserts. Use when editing Repo calls, Ecto.Query, or schema fields. Skip for Ash.

oliver-kriska/claude-elixir-phoenix · 45 tokens

ecto-constraint-debug

Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data. Use when seeing uniqueconstraint, foreignkeyconstraint, or checkconstraint errors.

oliver-kriska/claude-elixir-phoenix · 36 tokens

craft-pest

Testing Craft CMS 5 plugins and modules with Pest — test isolation, database safety, and the markhuot/craft-pest-core harness. ALWAYS load when writing, running, fixing, or reviewing tests for a Craft plugin or module, and whenever a suite touches a real Craft install. Covers why rollback is opt-in, tests/Pest.php +…

michtio/craftcms-claude-skills · 353 tokens

testing-paperclip

Paperclip-Testing-Strategie — Vitest, Plugin-Test-Harness aus @paperclipai/plugin-sdk/testing, echte Postgres-Integration-Tests, Cross-Tenant-Isolation. Verwenden Sie dies beim Schreiben oder Reviewen von Paperclip-Tests.

TheBeardedBearSAS/claude-craft · 57 tokens

tools-unity-test-framework

Unity Test Framework patterns for EditMode and PlayMode tests including async testing, mocking, and test organization.

IdoCohen560/claude-unity-game-studio · 27 tokens

solution-validation-testing

When the user wants to verify optimization code: independent feasibility checkers, objective recomputation separate from the solver, unit tests for constraint builders and operators, known-optimum regression tests, and exact-vs-heuristic cross-validation on small instances. Also use when the user mentions "validate…

hajibabaie/combinatorial-optimization-skills · 121 tokens