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! |
Beta Was this translation helpful? Give feedback.
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 |
Beta Was this translation helpful? Give feedback.
-
|
Okay, I will work without it then, thanks! Feel free to close the discussion if appropriate. All the best. |
Beta Was this translation helpful? Give feedback.
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