testing-database-code

Test pgdbm-based code using predefined fixtures and patterns.

Updated Jul 28, 2025
One-click install
npx skills add https://github.com/juanre/pgdbm --skill testing-database-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-database-code
Source: https://github.com/juanre/pgdbm/tree/main/skills/testing-database-code
Command: npx skills add https://github.com/juanre/pgdbm --skill testing-database-code

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach to testing pgdbm-based code by presenting a curated set of fixtures and usage patterns, removing guesswork from test setup.

Core Features & Use Cases

  • Fixture selection: Choose from predefined fixtures to isolate tests, speed up runs, and ensure proper cleanup.
  • Pattern guidance: Clear examples showing how to compose tests with fixtures, transactions, and migrations, including best practices for reusability.
  • Use Case: When writing tests for a module that uses pgdbm, use these fixtures to avoid manual database management and guarantee cleanup.

Quick Start

Use the provided fixtures via tests/conftest.py to structure tests for pgdbm-based code, following the fixture selection decision tree and usage patterns shown in the guide.

Frequently Asked Questions about testing-database-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up fixtures for testing pgdbm-based code?

Use predefined fixtures from tests/conftest.py to structure your pgdbm tests. The Skill provides a fixture selection decision tree covering test_db, test_db_with_tables, and related fixtures that handle database isolation, cleanup, and common scenarios like migrations and transactions automatically.

What's the best way to organize pytest tests for database code?

Organize tests by leveraging fixture composition patterns shown in this guide. Structure unit and integration tests using appropriate fixtures based on your needs—fixtures manage AsyncTestDatabase setup, teardown, and data isolation so you focus on test logic.

Do I need to manually manage AsyncTestDatabase in my tests?

No. This Skill enforces using fixtures instead of manual AsyncTestDatabase usage. Predefined fixtures handle all database management, cleanup, and lifecycle concerns, eliminating guesswork and ensuring reliable test isolation.

How do I test database migrations and transactions with pgdbm?

The Skill demonstrates patterns for composing tests with fixtures that support migration and transaction scenarios. Examples show best practices for reusable test patterns that safely validate migrations, transaction behavior, and data setup without manual database handling.

What testing patterns reduce database test setup time?

Use fixture selection to match your test scope—lighter fixtures speed up runs for unit tests, while comprehensive fixtures ensure proper data state for integration tests. The Skill's decision tree guides you to choose fixtures that isolate tests and guarantee cleanup.

Can I use these fixtures for both unit and integration tests?

Yes. The Skill covers fixture patterns for both unit and integration testing scenarios. Fixture composition lets you scale from minimal setup for isolated unit tests to full database state for integration tests, all with consistent cleanup.