pytest-ansible
Plugin for pytest to simplify calling ansible modules from tests or fixtures
Decision gist · record as of 2026-08-14
Yes, if you have an existing pytest-ansible codebase or need to test Ansible modules in pytest today—the plugin is stable and actively maintained. However, no for new projects: the maintainers recommend using plain pytest with parametrize and subprocess helpers (documented in the package), or Molecule for multi-host integration. Plan for migration before December 2026 EOL.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or newer and ansible-core 2.14 or newer under active upstream support.
- Low friction install with a wheel distribution.
- Actively maintained as of August 2026, though the project is planned for end-of-life in December 2026; existing users should pin releases if long-term stability is required.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2026-08-12 (2 days) · last repo commit 2026-08-14 · 225 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 983,385 downloads/mo, #4,580 on PyPI
Alternatives
Verify before relying
pip install pytest-ansible
# In tests/conftest.py or test file:
import subprocess
def test_ping(hostname: str) -> None:
subprocess.run(
["ansible", "-i", "inventory", hostname, "-m", "ping"],
check=True,
)- Whether the deprecated status and December 2026 EOL timeline affects your project's long-term maintenance plans.
- Whether existing pytest-ansible fixtures in your codebase are compatible with the recommended migration patterns (parametrize, subprocess helpers).
What it is and what it does
pytest-ansible is a pytest plugin that bridges Ansible and pytest testing workflows. It was originally designed to let you call Ansible modules and iterate over inventory from inside test functions, eliminating the need for shell scripting. The plugin has been actively maintained since July 2014 and supports Python 3.10+ and ansible-core 2.14+.
However, the maintainers have announced planned end-of-life in December 2026, as the broader ecosystem—including plain pytest, ansible-test, Molecule, tox-ansible, and ansible-dev-environment—now provides better-integrated solutions for collection testing and orchestration. The plugin remains functional and installable for existing users, but the documentation includes migration patterns using parametrize and subprocess helpers to replace its fixtures. If you are starting a new project, the migration paths in the documentation are the recommended approach.
Use it for
- Run unit tests for Ansible collection modules using pytest with only Python 3.10+ and ansible-core installed.
- Iterate over hosts and groups from an Ansible inventory within pytest parametrized tests without writing shell wrappers.
- Execute ad-hoc Ansible module calls from pytest test functions to validate module behavior in isolation.
- Integrate Ansible module testing into existing pytest CI pipelines for collections under active development.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you have an existing pytest-ansible codebase or need to test Ansible modules in pytest today—the plugin is stable and actively maintained.
However, no for new projects: the maintainers recommend using plain pytest with parametrize and subprocess helpers (documented in the package), or Molecule for multi-host integration. Plan for migration before December 2026 EOL.
Install
pytest-ansible on PyPI
Before you install
Low friction install with a wheel distribution. Actively maintained as of August 2026, though the project is planned for end-of-life in December 2026; existing users should pin releases if long-term stability is required.
Requires Python 3.10 or newer and ansible-core 2.14 or newer under active upstream support.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install pytest-ansible
# In tests/conftest.py or test file:
import subprocess
def test_ping(hostname: str) -> None:
subprocess.run(
["ansible", "-i", "inventory", hostname, "-m", "ping"],
check=True,
)
Verify before relying
- Whether the deprecated status and December 2026 EOL timeline affects your project's long-term maintenance plans.
- Whether existing pytest-ansible fixtures in your codebase are compatible with the recommended migration patterns (parametrize, subprocess helpers).
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 7 packagesansible-compatansible-corecffipackagingpytestpytest-xdisttyping-extensions |
| Maintenance | Actively maintained 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 983,385 / month, #4,580 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Software Development :: Quality AssuranceTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: pytest_ansible-26.8.0-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 › “ansible pytest plugin”
- pytest-ansibleA pytest plugin that integrates Ansible into test functions, allowing…
- tox-ansibleA tox plugin that orchestrates testing of Ansible collections across…
- pytest-testinfraA pytest plugin that lets you write Python unit tests to verify the…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
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.
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.
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.
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.
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.
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.
See also tox-ansible · ansible-dev-tools · molecule-vagrant · molecule · molecule-multipass · molecule-plugins · pytest-testinfra · testinfra · molecule-docker · pytest-redis