pytest can run test classes, but functions are a better way. Each test function uses a fixture for setup. Compare this example to test_calc.py in example-py-unittest.