print("running method - "class testclass (basetest)def test_method_ (self)print("running method - "def test_method_ (self)print("running method - "the sole purpose of the basetest class is to extract four methods that would be otherwise identical to the test classesand use inheritance to reduce the amount of duplicate code sofrom the point of view of py testthe two subclasses have not only two test methods eachbut also two setup and two teardown methods (one at the class levelone at the method levelif we run these tests using py test with the print function output suppression disabled (by passing the - or --capture=no flag)they show us when the various functions are called in relation to the tests themselvespy test setup_teardown py - setup_teardown py setting up module setup_teardown running test function setting up class testclass setting up method test_method_ running method - tearing down method test_method_ setting up method test_method_ running method - tearing down method test_method_ tearing down class testclass setting up class testclass setting up method test_method_ running method - tearing down method test_method_ setting up method test_method_ running method - tearing down method test_method_ tearing down class testclass tearing down module setup_teardown