Pytest Tutorial - 2 | The Basics - Installation
Dear learners, If you haven’t read my previous article - What is pytest? I would highly recommend you to read it.
However if you are confident enough then let’s get started.
TLDR: Skip to the last step of this article for installation notes.
Prerequisites for this tutorial:
I'm going to use pycharm,
however you can use your favourite IDE.
Python 3.10
We will start by creating a project.
Open pycharm and create new Project
Name your project whatever you want, I will name it pytest_beginner_tutorial
Select new environment using Virtualenv,
(new virtual environment ensures isolated development environment for our pytest tutorial).
Hit create button.
Your project directory should look like below:
Lets create a requirements file to handle python package installation.
Right click on the project > New > File
Give file name as below:
Once this file is created open the file and in the first line write “pytest”.
Open terminal in pycharm and run below command:
(it will automatically open with virtual environment activated)
pip install -r requirements.txt
Above command will install all the python packages mentioned in our requirements.txt.
Since we only have pytest, it will install pytest and its required dependencies.
That’s it folks we have successfully created a project to learn pytest and installed pytest using requirements.txt.
In the next tutorial, we will explore basic usage of pytest.
Stay tuned and let me know your thoughts in the comment section below!
Comments
Post a Comment