ut python Python Unit Test Basic pytest.fixture scope Available scopes are function, class, module, and session. The default scope is function. Python@pytest.fixture(scope='function') def test_function(): pass Mock Mock a class with attributes Pythonobj = Mock(spec=Class, attr=value)