How To Install python-mocker on Ubuntu 20.04

In this tutorial we learn how to install python-mocker on Ubuntu 20.04. python-mocker is Mocker object mocking framework

Introduction

In this tutorial we learn how to install python-mocker on Ubuntu 20.04.

What is python-mocker

python-mocker is:

Mocker provides an API for mocking Python objects in unit tests. Mocker provides graceful creation of test doubles (mocks, stubs, fakes, and dummies) for Python testing needs.

There are three methods to install python-mocker on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-mocker Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-mocker using apt-get by running the following command:

sudo apt-get -y install python-mocker

Install python-mocker Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-mocker

Install python-mocker Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-mocker using aptitude by running the following command:

sudo aptitude -y install python-mocker

How To Uninstall python-mocker on Ubuntu 20.04

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

sudo apt-get remove python-mocker

Uninstall python-mocker And Its Dependencies

To uninstall python-mocker and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove python-mocker

Remove python-mocker Configurations and Data

To remove python-mocker configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge python-mocker

Remove python-mocker configuration, data, and all of its dependencies

We can use the following command to remove python-mocker configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-mocker

References

Summary

In this tutorial we learn how to install python-mocker package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.