pytest-docker-tools
Docker integration tests for pytest
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem—eliminating boilerplate for Docker-based testing. It's well-suited for teams running integration or smoke tests against containerized services. The permissive Apache-2.0 license poses no restriction. Install it if you're writing tests that need Docker containers.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Docker daemon running and accessible; pytest must be installed.
- Low friction: pure Python wheel with only pytest and docker as runtime dependencies.
- Active maintenance with a release 24 days ago; repository shows 102 stars and no archived status.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 is permissive; you can use this in commercial projects and modify it freely, with minimal restrictions beyond preserving license notices.
last release 2026-07-21 (24 days) · last repo commit 2026-07-21 · 102 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,737,976 downloads/mo, #3,603 on PyPI
Alternatives
Verify before relying
pip install pytest-docker-tools
# In conftest.py
from pytest_docker_tools import container, fetch
my_image = fetch(repository='redis:latest')
my_container = container(image='{my_image.id}', ports={'11211/tcp': None})
# In test_example.py
def test_redis(my_container):
port = my_container.ports['11211/tcp'][0]
# connect and test- Whether fixture scopes (session, module, function) work as documented with pytest-xdist parallelism.
- Performance characteristics when managing many concurrent containers under xdist.
- Compatibility with Docker Desktop vs. other Docker installations.
What it is and what it does
pytest-docker-tools is a fixture factory library that lets you define Docker-based test environments declaratively in pytest, similar to docker-compose.yml syntax. Instead of writing boilerplate code to spin up containers for each test, you define fixtures once in conftest.py and inject them into tests; the library handles creation, teardown, and dependency resolution automatically. It supports fixture scoping (session, module, function), automatic port mapping, environment variable injection, and container restart operations.
The library is built on pytest and docker as its only runtime dependencies, making installation straightforward. It's designed for smoke testing Docker images and integration testing microservices, with explicit support for parallel test execution via pytest-xdist. Fixtures can be overridden per test module, and the library captures Docker logs on test failure for debugging.
Use it for
- Smoke-test a freshly built Docker image before release to verify it starts and responds correctly.
- Integration test a microservice by spinning up dependent containers (database, cache, mock DNS) per test with automatic cleanup.
- Run parallel integration tests across multiple CPU cores using pytest-xdist, with automatic port and resource name collision avoidance.
- Reuse long-lived containers (session scope) across multiple test modules while recreating module-scoped resources between modules.
- Test container restart behavior and recovery without manual container lifecycle management in test code.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem—eliminating boilerplate for Docker-based testing. It's well-suited for teams running integration or smoke tests against containerized services. The permissive Apache-2.0 license poses no restriction. Install it if you're writing tests that need Docker containers.
Install
pytest-docker-tools on PyPI
Before you install
Low friction: pure Python wheel with only pytest and docker as runtime dependencies. Active maintenance with a release 24 days ago; repository shows 102 stars and no archived status.
Requires Docker daemon running and accessible; pytest must be installed.
License in practice
Apache-2.0 is permissive; you can use this in commercial projects and modify it freely, with minimal restrictions beyond preserving license notices.
Quickstart
pip install pytest-docker-tools
# In conftest.py
from pytest_docker_tools import container, fetch
my_image = fetch(repository='redis:latest')
my_container = container(image='{my_image.id}', ports={'11211/tcp': None})
# In test_example.py
def test_redis(my_container):
port = my_container.ports['11211/tcp'][0]
# connect and test
Verify before relying
- Whether fixture scopes (session, module, function) work as documented with pytest-xdist parallelism.
- Performance characteristics when managing many concurrent containers under xdist.
- Compatibility with Docker Desktop vs. other Docker installations.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release <4.0.0,>=3.9.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespytestdocker |
| Maintenance | Actively maintained 24 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,737,976 / month, #3,603 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Topic :: Software Development :: Testing |
Evidence: pytest_docker_tools-3.1.10-py2.py3-none-any.whl
Tags
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 › “smoke testing docker images”
- pytest-docker-toolsProvides pytest fixture factories for declaratively defining…
- pytest-celerypytest-celery is the official pytest plugin for Celery that enables…
- tox-dockerA tox plugin that manages Docker container lifecycle during test…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
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.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also pytest-container · pytest-docker · pytest-factoryboy · pytest-mock-resources · pytest-redis · pytest-postgresql · pytest-rabbitmq · pytest-mysql · pytest-databases · pytest-shutil