def setup_method(self, method):
""" setup any state tied to the execution of the given method in a
class. setup_method is invoked for every test method of a class.
"""
@pytest.fixture
def my_service():
# some setup logic
service = Mock()
...
return service
def some_test(my_service):
...