pytest testing framework setting up pytest you will probably need to set up pytest so that you can use it from within your environment if you are using the pycharm editorthen you will need to add the pytest module to the current pycharm project and tell pycharm that you want to use pytest to run all tests for you simple pytest example something to test to be able to explore pytest we first need something to testwe will therefore define simple calculator class the calculator keeps running total of the operations performedit allows new value to be set and then this value can be added toor subtracted fromthat accumulated total class calculatordef __init__(self)self current self total def set(selfvalue)self current value def add(self)self total +self current def sub(self)self total -self current def total(self)return self total save this class into file called calculator py writing test we will now create very simple pytest unit test for our calculator class this test will be defined in class called test_calculator py you will need to import the calculator class we wrote above into your test_calculator py file (remember each file is module in python