How To Install python-fakesleep on Ubuntu 18.04

In this tutorial we learn how to install python-fakesleep on Ubuntu 18.04. python-fakesleep is Fake version of time.sleep() for use in tests

Introduction

In this tutorial we learn how to install python-fakesleep on Ubuntu 18.04.

What is python-fakesleep

python-fakesleep is:

The fakesleep module helps testing code that use time.sleep(). Sleeping in tests is generally considered bad (as it makes tests run slow). Using sleep with time.time() can lead to spurious failures, as clock precision / interpreter overhead can cause small differences in reported times.

This package provides the Python 2.x module.

There are three methods to install python-fakesleep on Ubuntu 18.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-fakesleep 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-fakesleep using apt-get by running the following command:

sudo apt-get -y install python-fakesleep

Install python-fakesleep Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-fakesleep

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

sudo aptitude -y install python-fakesleep

How To Uninstall python-fakesleep on Ubuntu 18.04

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

sudo apt-get remove python-fakesleep

Uninstall python-fakesleep And Its Dependencies

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

sudo apt-get -y autoremove python-fakesleep

Remove python-fakesleep Configurations and Data

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

sudo apt-get -y purge python-fakesleep

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

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

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

References

Summary

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