Parametrize depending on prior fixture value #13581
|
Hello there, Let's say I have A_VALUES = [1, 2]
@pytest.fixture(params=A_VALUES)
def a(request) -> int:
return request.paramand now I want to define a fixture @pytest.fixture(params=range(a)) # Not allowed
def b(request) -> int:
return request.parambut is ther something I can do to achieve the desired result? I tried looking at Thanks for your help! |
Answered by
RonnyPfannschmidt
Jul 2, 2025
Replies: 2 comments
|
Parameterize happens before fixtures Currently fixtures cannot be used as input for Parameterize A workaround would be a pytest plugin which creates the instances and implemets generate tests plus cleanup |
0 replies
Answer selected by
RonnyPfannschmidt
|
Okay, I will work without it then, thanks! Feel free to close the discussion if appropriate. All the best. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Parameterize happens before fixtures
Currently fixtures cannot be used as input for Parameterize
A workaround would be a pytest plugin which creates the instances and implemets generate tests plus cleanup