Registry / testing / tox-docker

tox-docker

JSON →
library5.0.0pypypi✓ verified 81d ago

Manage lifecycle of Docker containers during Tox test runs. Version 5.0.0 introduces a major breaking change: tox-docker is now a plug-in installable via the pyproject.toml [tox.env_run_base] requires or as a plugin. Requires tox 4+.

pip install tox-docker
INSTALL
IMPORT
SIG · TOX-DOCKER
T
tox-docker
testingpythonv5.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

config
from tox_docker import config
from tox_docker import ToxDocker
plugin
from tox_docker import plugin
from tox_docker import ToxDocker

Configure tox-docker as a plugin, then run tox. Containers defined via `docker` option in testenv are started/teardown automatically.

# In pyproject.toml or tox.ini # pyproject.toml: # [tool.tox.env_run_base] # requires = ["tox-docker"] # tox.ini: # [tox] # requires = tox-docker # # [testenv] # deps = pytest # commands = pytest # docker = postgres:13-alpine # optional, start containers # Then run: # tox
Debug
Known issues
breakingtox-docker 5.x dropped support for tox <4.0. Upgrade to tox 4+.
fix
Upgrade tox to >=4.0.0 and follow new plugin configuration: add 'requires = tox-docker' to tox.ini or pyproject.toml.
affects: <5.0.0
breakingThe 'docker' option in testenv now expects image names only; previously you could specify complex options. Use 'docker_compose' for compose files.
fix
If you need custom options, switch to docker-compose integration or use the container_options in configuration.
affects: >=5.0.0
deprecatedThe 'docker_compose' option is deprecated in 5.x and will be removed in 6.0. Use 'compose' and 'compose_project_name' instead.
fix
Rename 'docker_compose' to 'compose' in tox.ini.
affects: 5.x
gotchaContainers are started for each testenv but not shared across environments. If you need shared containers, use a global docker service approach.
fix
Define containers under a global ['docker'] section but note they are still per-environment.
affects: *
gotchatox-docker 5.x requires Python 3.9+ and Docker SDK. Ensure docker-py is installed.
fix
Run `pip install docker` if not already installed.
affects: >=5.0.0
Upgrade
Version history
5.0.0latest on PyPI · released May 25, 2024
Audit
Dependencies
toxrequiredtox-docker 5.x requires tox >= 4.0.0 as a plugin host
dockerrequiredPython docker SDK (docker-py) is used for container management
Agent activity
11 hits · last 30 days
node
10
Resources
tox-docker — pip install tox-docker · libregistry