I want to pass a pytest.fixture function to another fixture function's param argument. Something like this:
@pytest.fixture()
def foo():
return "foo"
@pytest.fixture()
def boo(foo):
return foo + "boo"
@pytest.fixture()
def bar(foo):
return foo + "bar"
@pytest.fixture(params=[boo, bar], ids=["boo_fixture", "bar_fixture"])
def final_fixture(request):
return request.param
def _test(final_fixture):
assert final_fixture.startswith('foo')
The request.param in final_fixture returns the function object for that param, instead of the return value of the fixtures(boo and bar)
<function boo at 0x7f2bfceg41f0>
<function bar at 0x7f2bfceg41f1>
So, how can I make the final_fixture function return the actual return values for each fixture param?