testing.common.database
utilities for testing.* packages
What it is and what it does
testing.common.database is a base-class library for building database testing frameworks. It provides a Database class that you subclass to define how to initialize, start, and check the health of a temporary database instance, plus a DatabaseFactory for managing multiple instances and caching initialized databases across test runs. It also includes utility decorators to skip tests when a database command is not found, and helpers like get_unused_port() and get_path_of() for locating free ports and executables.
The package is designed to be inherited and extended, not used directly. You implement hooks like initialize_database(), get_server_commandline(), and is_server_available() to teach it how to manage your specific database. Once subclassed, you can use it as a context manager to spin up isolated database instances for each test, optionally caching the initialized state to avoid repeated setup overhead.
Use it for:
- Build a PostgreSQL testing framework by subclassing Database and implementing database-specific initialization and server-launch logic.
- Create a test suite that spawns temporary database instances on unused ports, avoiding conflicts between parallel test runs.
- Cache an initialized database schema across multiple tests to reduce per-test setup time while maintaining isolation.
- Skip database-dependent tests when the database server executable is not found on the system.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides base classes and utilities for building database testing frameworks, allowing you to create isolated, temporary database instances for test suites.
No. The package is abandoned (last release October 2017, last commit December 2021) and receives no maintenance or security updates. While it has low install friction and permissive licensing, it is a template library requiring substantial subclassing work, and there is no active support or modern alternatives documented. Use only if you are maintaining legacy code already depending on it; for new projects, evaluate actively maintained testing frameworks.
Install
testing-common-database on PyPI
pip
pip install testing-common-databaseuv
uv add testing-common-databasepoetry
poetry add testing-common-databaseInstalling testing.common.database
Before you install
Low install friction with no runtime dependencies. However, the package is abandoned—last release was 2017-10-23 and last commit 2021-12-18—so it receives no active maintenance or security updates.
License in practice
Licensed under Apache License 2.0 (permissive), so you may use, modify, and distribute it freely in commercial and private projects with minimal restrictions.
Quickstart
pip install testing.common.database
from testing.common.database import Database, DatabaseFactory
class MyDatabase(Database):
def initialize(self):
pass
def get_data_directory(self):
return '/path/to/data'
def get_server_commandline(self):
return ['mydb', '--port', str(self.settings['port'])]
You must implement abstract methods (initialize, get_data_directory, get_server_commandline, is_server_available) in your subclass; the base class is a template, not a ready-to-use tool.
Verify before relying
- Whether the package works reliably with Python versions beyond 3.6 (classifiers list only up to 3.6; current Python is much newer).
- Whether subprocess-based database spawning (used since 2.0.0) is stable on modern operating systems.
- Real-world usage patterns and whether the caching and factory features work as documented in practice.
Package facts
| License | Apache License 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,217 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,507,297/month — #2,290 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: testing.common.database-2.0.3-py2.py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
testing.postgresqlAutomatically creates and tears down temporary…
permissive · top 5,000 on PyPI
pytest-pgsqlA pytest plugin that provides fixtures for…
permissive · top 15,000 on PyPI
testgrestestgres orchestrates temporary PostgreSQL…
unclear · top 15,000 on PyPI
pytest-postgresqlA pytest plugin that provides fixtures to…
copyleft · top 5,000 on PyPI
async-factory-boyExtends factory_boy to generate test fixtures…
permissive · top 15,000 on PyPI
pytest-databasesProvides pytest fixtures that spin up isolated…
permissive · top 15,000 on PyPI
py-pglitepy-pglite provides a zero-config PostgreSQL…
permissive · top 15,000 on PyPI
pytest-datadirA pytest plugin that provides fixtures for…
permissive · top 5,000 on PyPI
testcontainers-postgresProvides a PostgreSQL Docker container wrapper…
unclear · top 15,000 on PyPI
lamindb_setupConfigures and initializes LaminDB instances,…
unclear · top 15,000 on PyPI