Pytest Testinfra

Testinfra test your infrastructures
Alternatives To Pytest Testinfra
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
2 days ago2February 25, 2019157mitPython
🔎 Hunt down social media accounts by username across social networks
Kind12,0344027 days ago171June 15, 2023179apache-2.0Go
Kubernetes IN Docker - local clusters for testing Kubernetes
a month ago8mitSwift
Create useful .gitignore files for your project
Testcontainers Java7,3644316502 days ago85May 31, 2023471mitJava
Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
2 days ago128otherJava
Source for the TechEmpower Framework Benchmarks project
Terratest7,1061895 days ago405July 26, 2023232apache-2.0Go
Terratest is a Go library that makes it easier to write automated tests for your infrastructure code.
Goss5,2714311 days ago66July 21, 202329apache-2.0Go
Quick and Easy server testing/validation
Node Express Mongoose Demo5,085310 days ago1January 18, 20163mitJavaScript
A simple demo app using node and mongodb for beginners (with docker)
Boulder4,7692692 days ago76April 24, 2021206mpl-2.0Go
An ACME-based certificate authority, written in Go.
Maildev4,39154285 days ago45July 20, 2023111otherSCSS
:mailbox: SMTP Server + Web Interface for viewing and testing emails during development.
Alternatives To Pytest Testinfra
Select To Compare

Alternative Project Comparisons

Testinfra test your infrastructure

Latest documentation:


With Testinfra you can write unit tests in Python to test actual state of your servers configured by management tools like Salt, Ansible, Puppet, Chef and so on.

Testinfra aims to be a Serverspec equivalent in python and is written as a plugin to the powerful Pytest test engine


Apache License 2.0

The logo is licensed under the Creative Commons NoDerivatives 4.0 License If you have some other use in mind, contact us.

Quick start

Install testinfra using pip:

$ pip install pytest-testinfra

# or install the devel version
$ pip install 'git+'

Write your first tests file to

def test_passwd_file(host):
    passwd = host.file("/etc/passwd")
    assert passwd.contains("root")
    assert passwd.user == "root"
    assert == "root"
    assert passwd.mode == 0o644

def test_nginx_is_installed(host):
    nginx = host.package("nginx")
    assert nginx.is_installed
    assert nginx.version.startswith("1.2")

def test_nginx_running_and_enabled(host):
    nginx = host.service("nginx")
    assert nginx.is_running
    assert nginx.is_enabled

And run it:

$ py.test -v

====================== test session starts ======================
platform linux -- Python 2.7.3 -- py-1.4.26 -- pytest-2.6.4
plugins: testinfra
collected 3 items[local] PASSED[local] PASSED[local] PASSED

=================== 3 passed in 0.66 seconds ====================
Popular Testing Projects
Popular Docker Projects
Popular Software Quality Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Testing Tools
Infrastructure As Code
Devops Tools
Tdd Utilities