Multiple param values in fixture #10899
Unanswered
DavideCanton
asked this question in
Q&A
Replies: 1 comment 2 replies
|
If you want @pytest.fixture(params=[pytest.param((i, 5)) for i in range(5)])
def my_fixture(request):
return request.paramYou can also omit @pytest.fixture(params=[(i, 5) for i in range(5)])
def my_fixture(request):
return request.paramThen: def test_foo(my_fixture):
i, value = my_fixtureIf the pytest.param(i, id="5")Please mark this answer as accepted if it helped, thank you. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi all, I've noticed a not very well documented behavior in parametrizing fixtures.
A fixture with params errors out in the discovery if the params have multiple values. I believe it's because a single name fixture cannot bind different parameter values, but I didn't find anything about it in the docs, neither the error is clear:
All reactions