pytest testing framework pytest will recursively search down into sub directoriesunless they match norecursedirs environment variable in those directoriesit will search for files that match the naming conventions test_py or *_test py files tests can also be arranged within test files into test classes using test classes can be helpful in grouping tests together and managing the setup and tear down behaviours of separate groups of tests howeverthe same effect can be achieved by separating the tests relating to different functions or classes into different files test fixtures it is not uncommon to need to run some behaviour before or after each test or indeed before or after group of tests such behaviours are defined within what is commonly known as test fixtures we can add specific code to runat the beginning and end of test class module of test code (setup_moduleteardown_moduleat the beginning and end of test class (setup_class/teardown_classor using the alternate style of the class level fixtures (setup/teardownbefore and after test function call (setup_function/teardown_functionbefore and after test method call (setup_method/teardown_methodto illustrate why we might use fixturelet us expand our calculator testdef test_initial_value()calc calculator(assert calc total = def test_add_one()calc calculator(calc set( calc add(assert calc total = def test_subtract_one()calc calculator(calc set( calc sub(assert calc total =- def test_add_one_and_one()calc calculator(calc set( calc add(calc set( calc add(assert calc total =