$npx skillfedfor your agent

pytest-testinfra

Test infrastructures

With conditionsPyPI TestingReleased Mar 20251.5M downloads / mopermissive licensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_testinfra-10.2.2-py3-none-any.whl
v10.2.2 · released 2025-03-30 · Python >=3.9 · 1 runtime deps: pytest

Yes, if you manage infrastructure with configuration tools and want to verify actual server state in Python. The single pytest dependency keeps install friction low, and the permissive license poses no barrier. The aging maintenance status (502 days since last release) is a caution: the package is stable but may respond slowly to bugs or new requirements. Suitable for production use in established infrastructure workflows.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.9 or later.
  • Tests must run on or have network access to the target servers being inspected.
  • Low friction: a single runtime dependency on pytest, distributed as a wheel.

License · maintenance · safety

permissive license (permissive) — Apache License 2.0 (permissive). You can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

last release 2025-03-30 (502 days)

0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,545,408 downloads/mo, #3,779 on PyPI

Verify before relying

pip install pytest-testinfra

# In test_myinfra.py:
def test_passwd_file(host):
    passwd = host.file("/etc/passwd")
    assert passwd.contains("root")
    assert passwd.user == "root"

pytest -v test_myinfra.py
  • Whether the package supports all major configuration management tools (Salt, Ansible, Puppet, Chef) equally or has gaps in any.
  • Current maintenance activity and responsiveness to bug reports, given the 502-day gap since last release.
  • Whether remote testing over SSH or other protocols is fully documented and production-ready.
Same gist for agents: .md · .json

What it is and what it does

Pytest-testinfra is a pytest plugin that brings infrastructure testing into Python. Instead of writing shell scripts or separate test frameworks to verify server configuration, you write pytest test functions that inspect the actual state of your infrastructure—checking whether files exist with the right permissions, packages are installed, services are running, users have correct groups, and so on. It acts as a Python equivalent to Serverspec, integrating directly with pytest's test runner and reporting.

You typically use it after provisioning servers with tools like Ansible, Puppet, Chef, or Salt to verify that the configuration management actually produced the desired state. The package provides a `host` fixture that abstracts away the details of connecting to and querying target machines, so your tests read like straightforward assertions rather than shell command chains.

Use it for

  • Verify that Ansible playbooks or Puppet manifests correctly installed packages and configured services on target servers.
  • Assert file permissions, ownership, and content match infrastructure-as-code specifications after deployment.
  • Check that running services are enabled and listening on expected ports after configuration management runs.
  • Test user and group creation, membership, and home directory setup across a fleet of servers.
  • Validate system state in CI/CD pipelines after infrastructure provisioning to catch configuration drift early.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you manage infrastructure with configuration tools and want to verify actual server state in Python.

The single pytest dependency keeps install friction low, and the permissive license poses no barrier. The aging maintenance status (502 days since last release) is a caution: the package is stable but may respond slowly to bugs or new requirements. Suitable for production use in established infrastructure workflows.

Install

pytest-testinfra on PyPI

Before you install

Low friction: a single runtime dependency on pytest, distributed as a wheel. Maintenance status is aging—last release was 502 days ago—so expect slower response to issues, though the package is marked Production/Stable.

Requires Python 3.9 or later. Tests must run on or have network access to the target servers being inspected.

License in practice

Apache License 2.0 (permissive). You can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install pytest-testinfra

# In test_myinfra.py:
def test_passwd_file(host):
    passwd = host.file("/etc/passwd")
    assert passwd.contains("root")
    assert passwd.user == "root"

pytest -v test_myinfra.py

Verify before relying

  • Whether the package supports all major configuration management tools (Salt, Ansible, Puppet, Chef) equally or has gaps in any.
  • Current maintenance activity and responsiveness to bug reports, given the 502-day gap since last release.
  • Whether remote testing over SSH or other protocols is fully documented and production-ready.

Package facts

Licensepermissive license permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
pytest
MaintenanceAging 502 days since the last release
First released
Downloads1,545,408 / month, #3,779 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableEnvironment :: ConsoleFramework :: PytestIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: Apache Software LicenseOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.9Topic :: Software Development :: TestingTopic :: System :: Systems Administration

Evidence: pytest_testinfra-10.2.2-py3-none-any.whl

Tags

Capabilities
infrastructure testing pythonserver state verificationpytest infrastructure testsansible puppet chef testingconfiguration management validationinfrastructure as code testingsystem state assertions
Topics
infrastructure-testingconfiguration-managementserver-validation

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 › “infrastructure testing python”

  • pytest-testinfraA pytest plugin that lets you write Python unit tests to verify the…
  • testinfraTestinfra lets you write Python unit tests that verify the actual…
  • molecule-pluginsProvides driver plugins for molecule that enable testing across…

Give your agent the search over MCP, or paste the wish link into any chat.

More Testing packages

pluggy Worth it
PyPI · Libraries · released May 2025

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.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

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.

MITpure Python · 3.10+
1.1Bdownloads / mo
virtualenv Worth it
PyPI · Libraries · released Aug 2026

virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.

MITpure Python · 3.9+
532.9Mdownloads / mo
coverage Worth it
PyPI · Testing · released Aug 2026

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.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
pytest-asyncio Worth it
PyPI · Testing · released May 2026

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.

Apache-2.0pure Python · 3.10+
275.9Mdownloads / mo
pytest-json-ctrf Worth it
PyPI · Testing · released Jul 2026

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.

MITpure Python · 3.8+
273.0Mdownloads / mo

See also testinfra · pytest-container · pytest-ansible · tox-ansible · pytest-selenium · pytest-instafail · pytest-base-url · pytest-isort · molecule-docker