If I have two parametrized fixtures, how can I create a single test function that is called first with the instances of one fixture and then with the instances of the other
It is not beautiful, but may be today you know the better way.
Request object inside 'all' fixture know only about own params: 'lower', 'upper'. One way using fixtures from a fixture function.
import pytest
@pytest.fixture(params=[1, 2, 3])
def lower(request):
return "i" * request.param
@pytest.fixture(params=[1, 2])
def upper(request):
return "I" * request.param
@pytest.fixture(params=['lower', 'upper'])
def all(request, lower, upper):
if request.param == 'lower':
return lower
else:
return upper
def test_all(all):
assert 0, all