How To Install python2-testinfra on CentOS 7

In this tutorial we learn how to install python2-testinfra on CentOS 7. python2-testinfra is Unit testing for config-managed server state

Introduction

In this tutorial we learn how to install python2-testinfra on CentOS 7.

What is python2-testinfra

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

We can use yum or dnf to install python2-testinfra on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install python2-testinfra.

Install python2-testinfra on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install python2-testinfra using yum by running the following command:

sudo yum -y install python2-testinfra

Install python2-testinfra on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install python2-testinfra using dnf by running the following command:

sudo dnf -y install python2-testinfra

How To Uninstall python2-testinfra on CentOS 7

To uninstall only the python2-testinfra package we can use the following command:

sudo dnf remove python2-testinfra

References

Summary

In this tutorial we learn how to install python2-testinfra on CentOS 7 using yum and dnf.