skillfed

testing.common.database

utilities for testing.* packages

testing-common-database v2.0.3 4.5M downloads/30d#2,290 on PyPI6
Permissive license Apache License 2.0 Abandoned released

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-database

uv

uv add testing-common-database

poetry

poetry add testing-common-database

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Topic :: DatabaseTopic :: Software DevelopmentTopic :: Software Development :: Testing

Tags

database testing utilitiestemporary database for testsdatabase test fixturestesting database frameworkisolated database testingdatabase test harness
database-testingtest-fixturesabandoned

More Software Development packages