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/:
- Supported Databases
- Examples for PostgreSQL, MySQL, Oracle with service/connection fixtures.
- Complete Reference
- Fixture tables for all supported SQL, KV, Search, and Object Storage databases.
- Xdist Parallel Testing
- Isolation levels (database vs server) and helper functions.
- Configuration
- Fixture overrides and environment variable support.
- Troubleshooting
- ARM architecture tips, port conflicts, and health checks.
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
xdistisolation helpers. For parallel runs, select thedatabase-level orserver-level isolation fixtures fromreferences/xdist.mdinstead 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.
Validation Checkpoint
-
conftest.pydeclares 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 viareferences/xdist.md - CI runs Docker-in-Docker (or Podman) with enough resources for the requested fixtures
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
- https://github.com/litestar-org/pytest-databases
- https://litestar-org.github.io/pytest-databases/latest/
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