Skillquality 0.45

pytest-databases

Auto-activate for pytest_databases imports, conftest.py database fixtures, Docker-backed PostgreSQL/MySQL/SQLite/Oracle tests, or integration-test database lifecycle. Use when configuring pytest database containers and fixtures. Not for mocked databases or non-pytest test framewo

Price
free
Protocol
skill
Verified
no

What it does

pytest-databases

A pytest plugin providing ready-made database fixtures for testing using Docker containers.


<workflow>

References Index

For detailed guides and code examples, refer to the following documents in references/:

Quick Start

1. Enable in Project

Add to conftest.py:

pytest_plugins = ["pytest_databases.docker.postgres"]

2. Use Fixtures

def test_database(postgres_service):
    # Use postgres_service.host, .port, etc.
    pass
</workflow> <guardrails>

Guardrails

  • Keep fixtures container-based. Do not monkey-patch or mock the database client — prefer the real service fixture so tests cover driver behavior.
  • Use xdist isolation helpers. For parallel runs, select the database-level or server-level isolation fixtures from references/xdist.md instead of sharing one schema across workers.
  • Do not hand-roll container lifecycle. Rely on the plugin's fixtures; they handle startup, readiness, and teardown.
  • Scope fixtures to the smallest unit that works. A session-scoped Docker container with function-scoped schemas is almost always the right trade-off.
</guardrails> <validation>

Validation Checkpoint

  • conftest.py declares only the database plugins you actually use (pytest_plugins = [...])
  • Tests pull the correct fixture (postgres_service, mysql_service, etc.) rather than opening raw connections
  • Parallel runs (pytest -n auto) produce isolated data — verified via references/xdist.md
  • CI runs Docker-in-Docker (or Podman) with enough resources for the requested fixtures
</validation> <example>

Example: PostgreSQL integration test

import pytest

pytest_plugins = ["pytest_databases.docker.postgres"]


@pytest.mark.asyncio
async def test_user_insert(postgres_service, postgres_connection):
    await postgres_connection.execute(
        "INSERT INTO users (email) VALUES ($1)", "alice@example.com"
    )
    row = await postgres_connection.fetchrow(
        "SELECT email FROM users WHERE email = $1", "alice@example.com"
    )
    assert row["email"] == "alice@example.com"
</example>

Cross-References

  • litestar-testing — Litestar-specific testing patterns; integrates pytest-databases fixtures with AsyncTestClient.

Official References

Shared Styleguide Baseline

  • Use shared styleguides for generic language/framework rules to reduce duplication in this skill.
  • General Principles
  • Testing
  • Python
  • Keep this skill focused on tool-specific workflows, edge cases, and integration details.

Capabilities

skillsource-litestar-orgskill-pytest-databasestopic-advanced-alchemytopic-agent-skillstopic-agentskillstopic-ai-agentstopic-claude-code-plugintopic-claude-code-skillstopic-gemini-cli-extensiontopic-htmxtopic-inertiatopic-litestartopic-mcptopic-python

Install

Installnpx skills add litestar-org/litestar-skills
Transportskills-sh
Protocolskill

Quality

0.45/ 1.00

deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 7 github stars · SKILL.md body (3,489 chars)

Provenance

Indexed fromgithub
Enriched2026-05-18 19:13:55Z · deterministic:skill-github:v1 · v1
First seen2026-05-18
Last seen2026-05-18

Agent access