How To Install python-dbusmock on CentOS 7

In this tutorial we learn how to install python-dbusmock on CentOS 7. python-dbusmock is Mock D-Bus objects

Introduction

In this tutorial we learn how to install python-dbusmock on CentOS 7.

What is python-dbusmock

With this program/Python library you can easily create mock objects on D-Bus. This is useful for writing tests for software which talks to D-Bus services such as upower, systemd, ConsoleKit, gnome-session or others, and it is hard (or impossible without root privileges) to set the state of the real services to what you expect in your tests.

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

Install python-dbusmock on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

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

sudo yum -y install python-dbusmock

Install python-dbusmock 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 python-dbusmock using dnf by running the following command:

sudo dnf -y install python-dbusmock

How To Uninstall python-dbusmock on CentOS 7

To uninstall only the python-dbusmock package we can use the following command:

sudo dnf remove python-dbusmock

References

Summary

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