How to Install Pytest For Python3 On Linux?
Last Updated :
31 Jan, 2022
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
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
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
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.
Share your thoughts in the comments
Please Login to comment...