Python Pytest unpack fixture
问题 I have a fixture that creates a list of items during tests. I want to have another fixture which is parametrized with values generated by the first one. Example code import random import pytest @pytest.fixture def values(): return [random.randint(0, 100) for _ in range(10)] @pytest.fixture def value(request): return request.param @pytest.mark.parametrize("value", params=values): def test_function(value): assert value > 0 The problem with above code is that values is a function and not a list.