I'm trying to pass fixture into setup method:
@pytest.fixture
def my_fixture():
return 'value'
class TestSome:
def setup(self, my_fixture):
print(my_fixture) # <bound method TestSome.test_some of <test_views.TestSome object at 0x7ffc80e9b730>>
def test_method(self):
assert True
But as you can see it's not working. To fix this I'm forced to do this way:
class TestSome:
@pytest.fixture(autouse=True)
def setup_smth_with_my_fixture(self, my_fixture):
pass
def test_some(self):
assert False
Is there any way to pass fixture into setup method?