NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #2898 most downloaded on PyPI
Docker integration tests for pytest
Last release 2 months ago
21 Jul 2026
Ships unpredictably
gaps range from 3 weeks to 3.1 years
Some releases are documented
notes for 10 of 35 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
35 releases · first in 2018
This release is published under the Apache-2.0 License.
This release is published under the Apache-2.0 License.
Detailed Changes: v3.1.9...v3.1.10
v3.1.9 (2025-03-16) Chore chore: update Dockerfile ( 08c3cfc ) Fix fix: pyproject.toml typo ( 3517840 ) Unknown Fix: MANIFEST.in typo
One column per quarter.
v3.1.8 (2025-03-16) Fix fix: create MANIFEST.in
fix: container.ready() race condition, when exposed ports is not available yet
fix: include missing Dockerfile
fix: use setuptools to find correct package/module files
chore: add codespell for ci lint
89e5369)fix: correct classifiers (78318e9)
fix: version number must be preset (46363d2)
fix: don't check in version number (1b5adf1)
fix: get all lints passing (7556579)
fix: pre-commit settings (f50ebf1)
fix: explicit build backend (2cb886b)
fix: drop unsupported pythons (9310ce2)
fix: run pre-commit under uv (ba17370)
fix: add pre-commit deps (d48cfa6)
fix: make sure ci runs pytest (4ad0141)
fix: setuptools configuration was wrong (d4e85dc)
fix: modernize ci (b00c4f9)
5853f9b)89e5369)fix: correct classifiers (78318e9)
fix: version number must be preset (46363d2)
fix: don't check in version number (1b5adf1)
fix: get all lints passing (7556579)
fix: pre-commit settings (f50ebf1)
fix: explicit build backend (2cb886b)
fix: drop unsupported pythons (9310ce2)
fix: run pre-commit under uv (ba17370)
fix: add pre-commit deps (d48cfa6)
fix: make sure ci runs pytest (4ad0141)
fix: setuptools configuration was wrong (d4e85dc)
fix: modernize ci (b00c4f9)
Matters on Windows, where the path can contain backslashes, i.e.
C:\User... -> unknown unicode escape sequence. (4ae2274)
5853f9b)Fix deprecation warnings (`189f546`)
Updates README network section with better example (e51d353)
Reverts pytest changes and fixes import error in README (6f8ea99)
Limits pytest to tests/ subdirectory (1b16a04)
Bumps versions, sets minimum Python version to 3.7.0, adds TOML extra to coverage (2e2774e)
Updates README network section with better example (65b8edd)
Unpin docker version (533f806)
Version bumps (c7a18ee)
Abort release if something breaks (11eecfe)
Version bump (858d47d)
Merge pull request #39 from phillipuniverse/pytest-7.0
Allow compatibility with Pytest 7.0 (23e5c03)
Allow compatibility with Pytest 7.0 (d4a26ef)
Merge pull request #38 from alexanderpetrenz/main
Readme.md: Added section on new non-string fixture features (49835f0)
Readme.md now has a section explaining how to reference non string returning fixtures. (adf4172)
Version bump (61a7fbd)
Merge pull request #37 from alexanderpetrenz/main
Add ability to use non string returning Fixtures in Fixture Factory definitions (64f9f7a)
added import of fxtr to pytest_docker_tools/init.py, adjusted test (4e60e7b)
added some type hints to templates.py (99f0968)
added type hints to exceptions.py (2277d4b)
added type hints to utils.py (b66581f)
renamed FixtureRef to _FixtureRef and fixtureref to fxtr. Adjusted tests (e2ce02a)
adjusted condition in templates.py. Added test for using fixtures directly (a2d1e63)
moved fixtureref, adjusted tests (c8ed81d)
Update conftest.py
removed unused import (18d5bce)
clean ups (6531000)
added tests for using fixtureref and lambda (b2d6727)
removed obsolete fixture (12d167b)
extended conditions of classes FixtureFinder and Renderer in templates.py to identify Fixtures which are wrapped in a FixtureRef instance (43ae6e1)
added new wrapper class FixtureRef (6725256)
Update README.md (81d6c44)
Version bump (55fcf59)
Merge pull request #35 from Jc2k/track_staleness
Automatic replacement of stale containers (25ad943)
Lint (6b56bd9)
Add tests for image_or_build (8614aa1)
Switch to pytest.fail to be consistent (15a9ee6)
Update README to mention staleness tracking (0a98042)
Add unittests for network and volume helpers (2d951d6)
Integration tests for image() (b655b38)
Add unittests for signature handling (d87b8ad)
Add test for conflicting container when removing stale network (e2999b0)
Add test for conflicting container when removing stale volume (91c0797)
Lint (c8f324c)
More cleanup before merging (fe0996b)
Some refactoring + test coverage for container factory (36190e7)
Test test_reusable_conflict for networks (572184b)
Check error message for test_reusable_conflict (b6b77a6)
It should be an error if you try to use a volume that pytest-docker-tools didn't create (0b34fa9)
Rebuild containers if underlying netowrks and volumes change (30fbea1)
Automatic replacement of stale volumes (1f9074d)
Automatic replacement of stale networks (4ee3d14)
Automatic replacement of stale containers (b824455)
Add missing file (2456175)
Allow tests themselves to run under pytest-xdist (0aae7ea)
Test compatibility with pytest-xdist (25535f0)
Update dev notes (dedbefd)
Version bump (cb8ee97)
Add support for tagging build stages (9b89624)
Make 'reusable-container' label just 'reusable' as applies to networks, volumes, etc (eef72b9)
Merge pull request #32 from alexanderpetrenz/tests_reusable (cf5df26)
Merge pull request #30 from Jc2k/tests_reusable (de9a68c)
adopted README.md (93ec324)
Test we can set own labels on container, volume and network (fd477d7)
Allow test authors to set their own labels (8c443a5)
Fix labels (371c8de)
Assert fails if reuse without name (60a0f64)
Implement reuse for voumes and networks (473a71b)
Assert containers are reused (5bddcdb)
Version bump (662a4da)
Merge branch 'main' of github.com:Jc2k/pytest-docker-tools into main (7b3faf5)
Version bump (d99bdfb)
Merge pull request #29 from alexanderpetrenz/main
now evaluating --reuse-containers in network fixture factory (46f6ac1)
black (9e26e9e)
added volume test that covers reusable-container option (d7e580a)
now handling --reused_containers in volume fixture (34e3efa)
removed unused import (b27b31e)
black (3da37d1)
newline (fd1a513)
newline (0f0baa2)
black fix (38d357a)
created second network test (92b6989)
now evaluating --reuse-containers in network fixture factory to avoid attempting to delete network with active containers (e813c38)
Version bump (b161a3a)
Update release script (94a4419)
Dependency bumps (5f09a8b)
Merge pull request #27 from alexanderpetrenz/main
Introducing Reusable Containers (4bbc9ef)
adjustments on README.md (5c9bb1f)
adjustments on README.md (3aa511f)
black adjustment (f11705f)
renamed Label constant (cd3b403)
simplified is_reusable_container() (43eb6d8)
black related adjustments (62e3654)
isort related adjustments (cedee74)
4a690a3)added empty line (6cb6884)
now testing image fixture_factory (8c26e00)
black related fixes (f8e1de7)
resetting build path in orchestration fix (cb5afc8)
import order fix (05172a1)
minor fixes (a27ee9b)
docu fix (57ebef5)
adding documentation to README.md (07ba654)
fixing orchestration test by providing absolute path (de49eb2)
added test cases for container fixture factory (af2dbb4)
added documentation (5c01e11)
Adding command line option '--reuse_containers'
This option needs a given 'name' container attribute which is used to search for an already existing container.
If such a container exists it will be reused. If not a new container will be created.
The finalizer for removing the container at the end of test execution is not added if --reuse_containers is set (28d6d1d)
update (cdb1478)
bugfix: fixed TypeError: 'NoneType' object is not subscriptable (ae2442a)
bugfix: fixed TypeError: 'NoneType' object is not subscriptable (db70d65)
Version bump (06ac93c)
Fix #24 (2dcb931)
Add example for #19 (4537ab1)
Version bump (f873aae)
Version bumps (d2c44ab)
Test against python 3.9 (ed88718)
Merge pull request #22 from alexanderpetrenz/main
Fixing/Replacing Function utils.tests_inside_container (0601194)
Fix GitHub Actions config after they removed their set-env stuff (e004c42)
replaced implementation of utils.tests_inside_container as discussed in https://github.com/Jc2k/pytest-docker-tools/issues/20 (97128b6)
Improve coverage reporting (d8b2efa)
Version bump (2811d80)
Merge pull request #15 from Jc2k/modernize
Switch to GitHub actions and enable some of the usual linters (b030d51)
Fix deprecation warnings (189f546)
Install new pytest-markdown (179d83d)
Remove travis.yml (5f84e9f)
Update test matrix (86f5dab)
Add codecov to dev pkgs (05d6f21)
Remove .travis.yml (e5a340a)
Switch to GitHub actions and enable some of the usual linters (d45467b)
Release 0.2.3 (cc9a2ae)
Merge pull request #14 from alexpdp7/alexpdp7/stringiodockerfile
Support creating images from BytesIO Dockerfiles #13 (d230e4d)
Document how to create a container using BytesIO as the Dockerfile
Patch some cosmetic issues that arise doing so (97b8ee0)
Update README.md with development instructions (65b068b)
Ignore coverage artifacts (013d2ff)
Release 0.2.2 (4cfc68a)
Merge pull request #12 from soufyakoub/timeout_documentation
Update README.md (26e4602)
Add boilerplate for pytest-markdown tests (3ec2edb)
Update README.md (71bc73e)
Merge pull request #11 from soufyakoub/TypeError_fix
Closes #9: Fix container timeout TypeError (4baecbc)
Closes #9: Fix container timeout TypeError (5cca04e)
0.2.1 (1de7d05)
Merge pull request #10 from soufyakoub/wait_for_callable_timeout
Closes #9 : get timeout value from keyword arg (6ef282c)
Closes #9 : get timeout value from keyword arg (ed09d93)
Merge pull request #7 from Jc2k/dependabot/pip/urllib3-1.24.2
Bump urllib3 from 1.23 to 1.24.2 (34a8851)
Bumps urllib3 from 1.23 to 1.24.2.
Signed-off-by: dependabot[bot] <support@github.com> (25a1d7a)
0.2.0 (645ad55)
Merge remote-tracking branch 'origin/master' (46ceb13)
Merge pull request #3 from terrycain/master
Added IPv6 port binding support (6bfd8e4)
Add a test for #2 (f1b2297)
Bump requests version (8d06d52)
Added IPv6 port binding support (ceb4e88)
0.1.0 (0c561eb)
Don't look in kwargs for environ_key (824416e)
0.0.12 (cd476f2)
First split should be on new lines (d784fb6)
Add restart helper that waits for container to be ready again (b65d2d3)
Flake8 fixes (bb3525e)
Add heper for getting address (9c83304)
Add 'image_or_build' factory (c47f3d1)
Add 'image' factory (9ddd912)
0.0.11 (d61cf4e)
Missing file (dcfda5f)
Better log capture during fixture setup (e9c136d)
0.0.10 (0e94139)
Fix get_text (dca432b)
0.0.9 (02cdb1d)
Fix get_text wrapper (84cab44)
Allow fixture factory users to supply a wrapper_class (c1c6ce2)
Towards #1 - show how fixture scope applies to docker fixtures (68076f7)
Fix compat with py.test 3.7.0 and release 0.0.8 (02dc3a2)
Version bump (f06ebe1)
Tidy up intermediate containers (f262a9b)
Add Dockerfile needed by previous commit (8603305)
Allow volumes to be seeded with initial content (40f2676)
0.0.6 (a52b727)
Don't crash if fixture hasn't been evaluated yet (ea88d4d)
Bump pytest-markdown for better section names (68b4868)
0.0.5 (610fdd5)
Image fetch terminology fix (45d3327)
Allow users of factories to customize more stuff (d41c024)
Convert all factories to use the decorator (46e38d6)
Pull all templating and factory-izing contain out so it can be shared (75485ab)
Pull template handling out of container specific code (4dd9b8b)
Use awful code generation for fixture generation - this gives up proper static ahead of time dependencies (5bc9762)
Add a visitor that can extract a list of fixtures used during test setup (a7435a6)
Markdown tests are now a seperate plugin (e3add1f)
Bump to 0.0.4 (4c774e3)
Example tests in README are now executed by pytest (dac1cbc)
Towards README testing (7a5874a)
Show how you can make client fixtures that build on the apiserver server fixture (492b163)
Any code blocks marked '# conftest.py' will contribute fixtures towards other tests in the same header block (54679c6)
Ignore pycache files (938b99c)
Add an example 'microservice' (6261968)
Grim way of attaching logs of all relevant containers (a4d4024)
Group tests based on parent heading (bd9d067)
Closer (7cf6b62)
Towards README tests (f09143c)
Be explicit about imports in README (ae6a9d3)
Update README with syntax highlighting (f94a883)
Fix flake8 (b9a8356)
Capture more logs more of the time (89b3dd8)
Fix error when container has exited before starting (2fa3e33)
Doc fixes (e0ef0d7)
Pull in docker dep (31c24a3)
Version bump (a9901ea)
Tighten docs (0109fdc)
Document some of the more amazing pieces of gymnastics you can do with py.test fixtures (8b77faf)
Fix isort (1d4e8e5)
Document docker_client (332757a)
Document how to get logs from container (2bf27c9)
Review tests for xdist correctness (4f41622)
More docs (781d098)
Running tests under xdist works (62d90f4)
Make test less racey (9124504)
More docs (d428217)
More documentation (dcf03a6)
Install test deps on travis (65f3bc8)
Better API and docs (ae7cf2c)
Remove settings that don't apply any more (14a199d)
Update Trove classifiers (3f77a4a)
Install with flit (74ec981)
Remove setup.py (b64fceb)
flit: Add entrypoints (f0b8309)
Add pyproject.toml (29ec9b6)
Recurisvely allow referencing other fixtures from string templates (d549381)
Add a description (bd9790b)
Back to development: 0.0.2 (b36de61)
Add MANIFEST.in (7a62b10)
Fix port/proto split (af95f01)
Avoid pytest-cov (7c4f0cd)
Add missing module (1d65759)
Return a container object from the container fixture instead of a dict (d877926)
Automatically wait for port to be ready if user exposes a port (89dcef4)
Add a repository_image fixture that pulls the image (49fbc0f)
Enable Docker in travis tests (c78cc7c)
Fix py.test paths in .travis.yml (ff93905)
Turn on Travis and add code coverage (b173ee4)
Support extracting IP when using custom networks (6e1e111)
Attach container to its own private fixturized network (c98c023)
Can create test networks (63502ac)
More complicated example (b6bb440)
Update README to match API (f39e419)
More integration tests (cab3033)
More integration tests (c703cd6)
Flake8 fixes (4226397)
Flake8 and isort config (2c23213)
Actually test that a container is started (5bca459)
First pass of extracting useful Docker integration testing fixtures (a2895b7)
Nothing published for this version
⚠️ This is a breaking change. No code changes are needed to use 3.0.0, but existing reusable containers may be deleted and recreated automatically as…
Previously reusable containers were never replaced. Once they existed, that was it. So if you changed the fixture in code you had to manually clean up the previous fixture before continuing. This becomes even more annoying if you want to use this feature in your CI environment. This release tracks how stale a docker fixture is and replaces it if it becomes stale. This automatically handles the following cases:
fetch() fixture, for example to use postgres 14 and its new JSON syntax. You git pull and your tests start failing. Sometimes this might not be obvious and the breakage might be some time after the root cause.build() fixture. Right now the build will still run, but the old container with the old image will be used.In these sorts of situations instead of reusable containers saving you time, they cost time. And if the root cause isn't obvious, it might be a lot of time.
pytest-docker-tools now tags fixtures it makes with the label pytest-docker-tools.signature. This is a hash of the parameters used to create the fixture. When this signature changes, pytest-docker-tools knows the fixture is stale and replaces it.
⚠️ This is a breaking change. No code changes are needed to use 3.0.0, but existing reusable containers may be deleted and recreated automatically as they will be considered stale by the new code.
Warning breaking change. The labels used to track reusable containers have changed. Your containers may need to be removed manually when migrating to…
Warning breaking change. The labels used to track reusable containers have changed. Your containers may need to be removed manually when migrating to this release.
This release fleshes out "reusable containers" and applies the same logic to networks and volumes.
Image building can be slow. For some images, its by far the slowest part of your test cycle. Optimising your image build for layer reuse can help. But after many iterations your machine will acrue many iterations of your image as well. To keep the benefits of layer reuse but also keep housekeeping simple we recommend tagging your images when using build fixtures. This means that when you run docker image prune old versions of your image are deleted and the current version is kept.
from pytest_docker_tools import build
my_image = build(
path='db',
tag='localhost/myproject:latest'
)
If you make 20 changes to your project that cause 20 builds you will now see 20 images in docker images ls. Only one will be tagged localhost/myproject:latest. And when you run docker image prune that one image will be kept and the other 19 will be removed.
There is a problem, though. Multi-stage builds. You can't tag your building stages, so running docker image prune will delete your builder stages. These are often the slowest parts of the multi-stage build, and now you have to rebuild them.
As of pytest-docker-tools 2.0.0 build() gains a stages property. It lets you tag your builders.
from pytest_docker_tools import build
my_image = build(
path='db',
tag='localhost/myproject:latest',
stages={
'builder': 'localhost/myproject:builder'
}
)
Now when you prune the latest versions of your build stages and your final target image are all preserved. And the old versions are thrown away. Better build speeds, and you don't need a bigger hard drive.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →