Pytest Tutorial - 3 | The Basics - Write Tests
In our previous article, we understood how to install pytest via requirements.txt. Learning Goal: In this tutorial we will start by writing some unit tests for a calculator app. After finishing this tutorial you will be able to understand How basic unit tests can be performed with the help of pytest? How does pytest work? Given 2 numbers the calculator app, it can perform below operations: Add Subtract Multiply Divide If denominator is not 0 Throw a message ( Can't divide by 0 ) if the denominator is 0. Now let’s start with writing some unit tests to validate above functionalities and see pytest in action. Prerequisites: Clone the repo in your desired location: git clone https://github.com/TheEngrNest/pytest-tutorial-3.git We will start by opening this project in PyCharm. Once you have opened the project in PyCharm, kindly go through the contents of calculator.py inside calculator_app package. (can be seen right above the highlighted tests package in below step’s screenshot)...