GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - pytest-dev/pytest-testinfra: Testinfra test your infrastructures

BranchesTags
Open more actions menu

Latest commit

 

History

826 Commits
826 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
doc
doc
 
 
images
images
 
 
test
test
 
 
testinfra
testinfra
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
.readthedocs.yaml
.readthedocs.yaml
 
 
CHANGELOG.rst
CHANGELOG.rst
 
 
CONTRIBUTING.rst
CONTRIBUTING.rst
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.rst
README.rst
 
 
ansible.cfg
ansible.cfg
 
 
hatch.toml
hatch.toml
 
 
mypy.ini
mypy.ini
 
 
pyproject.toml
pyproject.toml
 
 
ruff.toml
ruff.toml
 
 
tox.ini
tox.ini
 
 

Repository files navigation

Testinfra test your infrastructure

Latest documentation: https://testinfra.readthedocs.io/en/latest

Important

Maintenance Notice

This project is currently not actively maintained, and responses to issues or pull requests may be delayed for several months. Please consider this when using the project and feel free to contribute via pull requests, which will be reviewed as time permits. Thank you for your understanding!

About

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

License

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+https://github.com/pytest-dev/pytest-testinfra@main#egg=pytest-testinfra'

Write your first tests file to test_myinfra.py:

def test_passwd_file(host):
    passwd = host.file("/etc/passwd")
    assert passwd.contains("root")
    assert passwd.user == "root"
    assert passwd.group == "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:

$ pytest -v test_myinfra.py


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

test_myinfra.py::test_passwd_file[local] PASSED
test_myinfra.py::test_nginx_is_installed[local] PASSED
test_myinfra.py::test_nginx_running_and_enabled[local] PASSED

=================== 3 passed in 0.66 seconds ====================

About

Testinfra test your infrastructures

testinfra.readthedocs.io

Topics

ansiblechefdevopsdevops-toolsdockerinfrastructure-as-codeinfrastructure-testingkubernetesnagiospuppetpytest-pluginpythonsaltstacktddtdd-utilitiestestingtesting-tools

Resources

Readme
Apache-2.0 license

Contributing

Contributing
Activity
Custom properties

Stars

2.5k stars

Watchers

66 watching

Forks

359 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.