$npx skillfedfor your agent

pytest-docker

Simple pytest fixtures for Docker and Docker Compose based tests

Worth itPyPI UtilitiesReleased Nov 20252.4M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_docker-3.2.5-py3-none-any.whl
v3.2.5 · released 2025-11-12 · Python >=3.8 · 2 runtime deps: pytest, attrs

Yes. pytest-docker is a well-established plugin (in top 5000 PyPI packages by downloads) with low install friction, permissive licensing, no known vulnerabilities, and active maintenance. It solves a real problem—automating container lifecycle for integration tests—cleanly. Install it if your test suite needs real containerized services rather than mocks or if you're already using docker-compose for local development.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Docker and Docker Compose V2 (or V1 via optional extra) must be installed and available in PATH on the test environment.
  • Low friction: pure Python wheel with only pytest and attrs as runtime dependencies.
  • Maintenance status is aging—last release 275 days ago—but the repository remains active with recent commits and no archived status.

License · maintenance · safety

MIT (permissive) — MIT license is permissive; safe for commercial and closed-source use without reciprocal obligations.

last release 2025-11-12 (275 days) · last repo commit 2025-11-12 · 488 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,387,633 downloads/mo, #3,092 on PyPI

Verify before relying

# Install
pip install pytest-docker

# In conftest.py or test file:
import pytest

@pytest.fixture(scope="session")
def docker_compose_file(pytestconfig):
    return "docker-compose.yml"

# In test:
def test_service(docker_services):
    port = docker_services.port_for("myservice", 80)
    # Use port to connect to containerized service
  • Whether Docker and Docker Compose V2 (or V1 via optional extra) are assumed to be pre-installed on the test environment.
  • Performance characteristics when managing many containers or long-running test suites.
  • Compatibility with Docker Desktop on Windows and macOS beyond the stated OS classifiers.
Same gist for agents: .md · .json

What it is and what it does

pytest-docker is a pytest plugin that manages Docker containers as test fixtures. It reads a docker-compose.yml file, starts all defined services before tests run, and tears them down afterward—all handled transparently by pytest's fixture system. You define your services once in compose YAML, then inject a docker_services fixture into your tests to query container ports, wait for readiness, and interact with running services.

The plugin handles the boilerplate of container lifecycle management, port mapping discovery, and health checks. It supports both Docker Compose V2 (default, via the docker compose command) and V1 (via optional extra or custom fixture override). Tests run against real containerized services rather than mocks, making integration tests more realistic and catching issues that unit tests miss.

Use it for

  • Write integration tests against a real database running in a container without manual docker-compose commands.
  • Test HTTP services by spinning up a containerized service and making requests to it from pytest.
  • Validate multi-service interactions in a single test run using docker-compose to define the stack.
  • Debug test failures in an IDE by pinning the compose project name and reusing containers across debug sessions.
  • Use multiple docker-compose files to compose different service stacks for different test scenarios.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

pytest-docker is a well-established plugin (in top 5000 PyPI packages by downloads) with low install friction, permissive licensing, no known vulnerabilities, and active maintenance. It solves a real problem—automating container lifecycle for integration tests—cleanly. Install it if your test suite needs real containerized services rather than mocks or if you're already using docker-compose for local development.

Install

pytest-docker on PyPI

Before you install

Low friction: pure Python wheel with only pytest and attrs as runtime dependencies. Maintenance status is aging—last release 275 days ago—but the repository remains active with recent commits and no archived status.

Docker and Docker Compose V2 (or V1 via optional extra) must be installed and available in PATH on the test environment.

License in practice

MIT license is permissive; safe for commercial and closed-source use without reciprocal obligations.

Quickstart

# Install
pip install pytest-docker

# In conftest.py or test file:
import pytest

@pytest.fixture(scope="session")
def docker_compose_file(pytestconfig):
    return "docker-compose.yml"

# In test:
def test_service(docker_services):
    port = docker_services.port_for("myservice", 80)
    # Use port to connect to containerized service

Verify before relying

  • Whether Docker and Docker Compose V2 (or V1 via optional extra) are assumed to be pre-installed on the test environment.
  • Performance characteristics when managing many containers or long-running test suites.
  • Compatibility with Docker Desktop on Windows and macOS beyond the stated OS classifiers.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
pytestattrs
MaintenanceAging 275 days since the last release
Last repo commit
First released
Downloads2,387,633 / month, #3,092 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Utilities

Evidence: pytest_docker-3.2.5-py3-none-any.whl

Tags

Capabilities
pytest docker fixturesdocker compose integration testscontainerized pytest testsdocker test automationpytest docker compose plugincontainer-based testingdocker fixtures pytest
Topics
dockerintegration-testingfixtures
PyPI keywords
dockerdocker-composepytest

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pytest docker fixtures”

  • pytest-dockerpytest-docker provides pytest fixtures that automatically spin up and…
  • pytest-docker-toolsProvides pytest fixture factories for declaratively defining…
  • pytest-databasesProvides pytest fixtures that spin up isolated database services in…

Give your agent the search over MCP, or paste the wish link into any chat.

More Utilities packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
charset-normalizer Worth it
PyPI · Utilities · released Aug 2026

Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.

permissive licensepure Python · 3.7+
1.7Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
Pygments Worth it
PyPI · Utilities · released Mar 2026

Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.

Install it if you need to display or transform source code.

BSD-2-Clausepure Python · 3.9+
1.3Bdownloads / mo
six With conditions
PyPI · Libraries · released Dec 2024

Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.

MITpure Python
1.2Bdownloads / mo

See also pytest-docker-tools · pytest-container · pytest-grpc · pytest-unused-fixtures · tox-docker · pytest-shutil · docker-compose · pytest-homeassistant-custom-component · pytest-print · pytest-postgresql