How To Install python-pytest-django on Ubuntu 18.04

In this tutorial we learn how to install python-pytest-django on Ubuntu 18.04. python-pytest-django is Django plugin for py.test.

Introduction

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

What is python-pytest-django

python-pytest-django is:

Running your test suite with pytest-django allows you to access features of pytest that wouldn’t normally be available with the Django’s manage.py test command.

This package contains the python 2 version.

There are three methods to install python-pytest-django 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-pytest-django 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-pytest-django using apt-get by running the following command:

sudo apt-get -y install python-pytest-django

Install python-pytest-django Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-pytest-django

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

sudo aptitude -y install python-pytest-django

How To Uninstall python-pytest-django on Ubuntu 18.04

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

sudo apt-get remove python-pytest-django

Uninstall python-pytest-django And Its Dependencies

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

sudo apt-get -y autoremove python-pytest-django

Remove python-pytest-django Configurations and Data

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

sudo apt-get -y purge python-pytest-django

Remove python-pytest-django configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge python-pytest-django

References

Summary

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