Closed
Description
I often end up using the same fixture twice (or even more times) in the same function, for example to get two temporary directories using tmp_path
. As far as a I know, this is currently only possible by manually creating a copy of the fixture:
tmp_path2 = tmp_path
def test_foo(tmp_path, tmp_path2):
assert something
I would love to see native support for this, and I think keyword arguments would be a nice way to achieve this from the user's perspective:
def test_foo(input_path=tmp_path, output_path=tmp_path):
assert something
This would give the user two (or more) independent instances of the fixture.
I don't know enough about the pytest internals to judge how hard this would be to implement, though.