Open
Description
Originally reported by: Florian Rathgeber (BitBucket: frathgeber, GitHub: frathgeber)
I often have a use case like the following contrived example:
@pytest.fixture
def a():
return 'a'
@pytest.fixture
def b():
return 'b'
@pytest.mark.parametrize('arg', [a, b])
def test_foo(arg):
assert len(arg) == 1
This doesn't currently do what's intended i.e. arg
inside the test function is not the fixture value but the fixture function.
I can work around it by introducing a "meta fixture", but that's rather ugly:
@pytest.fixture(params=['a', 'b'])
def arg(request, a, b):
return {'a': a, 'b': b}[request.param]
def test_foo(arg):
assert len(arg) == 1
It would be convenient if a syntax like in the first case was supported.