{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/4"},{"label":"Testing","url":"https://skillfed.io/packages/category/software-development-testing"}],"enrichment":{"capability":"A pytest plugin that provides fixtures to manage PostgreSQL database instances and connections for testing, handling both process lifecycle and client connection setup.","skillfed_tags":["postgresql","test-fixtures","database-testing"],"use_cases":["Unit testing code that queries or modifies PostgreSQL tables without needing manual database setup or teardown.","Integration testing with pre-populated schemas and seed data, using template cloning to avoid repeated setup overhead.","Testing against an external PostgreSQL instance in CI/CD by using the noproc fixture to connect to a running server.","Layering test data through chained fixtures, where each fixture adds its own schema or data on top of a previous layer.","Testing SQLAlchemy ORM code by creating a session fixture that wraps the postgresql connection.","Ensuring test isolation by automatically dropping test databases and terminating leftover connections after each test."],"what_it_does":"pytest-postgresql is a pytest plugin that automates PostgreSQL database setup and teardown for tests. It provides fixtures that either start a PostgreSQL instance on demand (session-scoped) or connect to an existing one, and manage test database creation, isolation, and cleanup. The plugin uses psycopg 3 to handle connections and database operations, returning a connected psycopg.Connection object to your test functions.\n\nThe plugin supports pre-populating test databases via SQL files or Python functions, with a template-cloning strategy that speeds up test runs by building a template database once per session and cloning it for each test. You can customize fixtures through factory functions, configure connection parameters via command-line options or pytest.ini, and chain multiple fixtures to layer data pre-population. It handles both managed PostgreSQL processes and connections to external instances (e.g., Docker containers).","worth_installing":"Yes. The plugin is actively maintained, has no known vulnerabilities, and solves a common testing problem with low install friction. Use it if you need to test code that interacts with PostgreSQL and want automated database lifecycle management. The copyleft license does not restrict your application code, only derivative works of the plugin itself."},"id":"pytest-postgresql","links":{"html":"https://skillfed.io/packages/pytest-postgresql","md":"https://skillfed.io/packages/pytest-postgresql.md","pypi":"https://pypi.org/project/pytest-postgresql/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-05-15","license_spdx":null,"license_treatment":"copyleft","name":"pytest-postgresql","python_support":"supports_current","summary":"Postgresql fixtures and fixture factories for Pytest."},"popularity":{"monthly_downloads":6639491,"position":1876,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"8.1.0"}
