Open In App

How to Install Pytest For Python3 On Linux?

Last Updated : 31 Jan, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The pytest module in Python or a testing framework. It is used to write small and simple tests cases for databases, APIs, etc, but it can also handle complex functional testing for applications and libraries. The tests are definitive and legible. Or we can say that this module is used to write test codes with the help of Python language. Some important features of pytest are:

  • It provides a very easy and simple syntax for test cases or codes.
  • It can also run tests parallelly.
  • It can also run the specific test or a subtest of test very efficiently.
  • It automatically detects tests. 
  • It also skips tests.
  • It provides different types of useful plugins
  • It can also be used to run doc tests and unit tests.

In this article, we will look into the steps of installing the pytest Package on the Linux Operating System.

Requirements:

Installing Pytest package on Linux using PIP

To install the Pytest package in Linux we have to follow the following steps:

Step 1: First we will install Python3 on Linux Machine with the help of the following command:

sudo apt-get install python3

Installing-Python3-on-Linux

Step 2: Now, install the pip module which is required to install and manage Python packages. So we use the following command for the installation process:

sudo apt install python3-pip

Installing-pip-module

Step 3: Now, install the Pytest package with the help of the following command.

sudo pip3 install pytest

or

sudo apt-get install python3-pytest

Installing-the-Pytest-package

Verifying Pytest package installation on Linux using PIP

To verify if the Pytest package has been successfully installed in your system run the below command in Terminal:

python3 -m pip show pytest

You’ll get the following message in the output if the installation is completed successfully.

Verifying-Pytest-package-installation


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads