tox-ansible
A radical approach to testing ansible content
What it is and what it does
tox-ansible is a tox plugin that generates and manages test environments for Ansible collections, automating the matrix of Python versions and Ansible releases you want to validate against. Instead of manually configuring tox environments for each combination, you declare your test scope in pyproject.toml and the plugin dynamically creates sanity, unit, and integration test environments. It delegates the actual testing to ansible-test (for sanity checks) and pytest (for unit and integration tests), leaving environments intact after runs so you can debug failures locally—and ensuring test outcomes match your CI/CD pipeline.
The plugin uses tox to create isolated virtual environments in .tox/, pyyaml and tomli to parse configuration, and pytest-xdist to parallelize test execution. You control which Python versions and Ansible versions to test via simple configuration flags like skip, coverage, and downstream (to include AAP-supported cores). CalVer versioning (YY.MM.MICRO) means releases track the month they ship, and the plugin is actively maintained with support for Python 3.10, 3.11, 3.12, 3.13, and 3.14.
Use it for:
- Test an Ansible collection against multiple Ansible versions and Python interpreters in a single command.
- Run sanity checks on collection code without manually invoking ansible-test, letting tox manage the environment.
- Generate coverage reports for unit tests across collection plugins, with 0% coverage shown for untested files.
- Reproduce CI/CD test failures locally by running the same tox environment names and configurations.
- Skip specific test environments or enable downstream AAP-certified Ansible cores via configuration flags.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A tox plugin that orchestrates testing of Ansible collections across multiple Python versions and Ansible releases, using ansible-test, pytest, and tox to manage environments.
Yes. If you maintain or test Ansible collections, this plugin eliminates manual environment setup and matrix configuration. Low install friction, active maintenance, no security vulnerabilities, and MIT licensing. The only gotcha is pre-installing the Python versions you want to test—a standard requirement for any multi-version testing tool.
Install
tox-ansible on PyPI
pip
pip install tox-ansibleuv
uv add tox-ansiblepoetry
poetry add tox-ansibleInstalling tox-ansible
Before you install
Low friction: pure Python wheel with no compiled dependencies. Active maintenance—released 2 days ago with last commit 2026-08-14. Requires Python >=3.10 and tox >=4.2, plus six runtime test dependencies (pytest, pytest-ansible, pytest-xdist, pyyaml, tomli, tox).
License in practice
MIT license (permissive) imposes no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install tox-ansible
# Add to pyproject.toml:
# [tool.tox]
# requires = ["tox>=4.2"]
# [tool.tox-ansible]
# Then run:
tox list --ansible
tox -e sanity-py3.11-2.14 --ansible
Requires tox >=4.2, Python >=3.10, and the specific Python interpreters you want to test against (e.g., python3.11, python3.12) pre-installed on your system.
Verify before relying
- Whether pytest-ansible and pytest-xdist are automatically installed as transitive deps or must be manually added to your test environment.
- Performance characteristics when running tests in parallel across many Ansible versions and Python interpreters.
- Whether coverage reports work correctly with PyPy in addition to CPython.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — pytest, pytest-ansible, pytest-xdist, pyyaml, tomli, tox |
| Maintenance | actively maintained — 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 628,645/month — #5,672 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tox_ansible-26.8.0-py3-none-any.whl
Keywords: ansible, collections, tox
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytest-ansibleA pytest plugin that integrates Ansible into…
permissive · top 5,000 on PyPI
ansible-compatProvides compatibility utilities for working…
permissive · top 5,000 on PyPI
ansible-dev-toolsBundles and installs a curated suite of Ansible…
copyleft · top 15,000 on PyPI
ansibleAnsible is an IT automation system that handles…
copyleft · top 5,000 on PyPI
moleculeMolecule is an Ansible testing framework for…
permissive · top 5,000 on PyPI
tox-ghtox-gh automatically selects and runs the…
permissive · top 15,000 on PyPI
molecule-dockerMolecule Docker Plugin enables Docker…
permissive · top 15,000 on PyPI
pytest-testinfraA pytest plugin that lets you write Python unit…
permissive · top 5,000 on PyPI
testinfraTestinfra lets you write Python unit tests that…
permissive · top 15,000 on PyPI
IxNetworkIxNetwork is a Python client library for…
permissive · top 15,000 on PyPI