This seems like a very basic question, but I looked at https://docs.pytest.org/en/6.2.x/reference.html, which I think is the reference for pytest and couldn’t find the answer.
So I wanted to combine a
pytest.fixture (setup/teardown using
yield) with a
pytest.mark.parametrize … and I realised that they both have to be included as parameters in the test function.
A simple experiment showed that it doesn’t appear to matter what order they are listed in the list of parameters, so my working assumption currently is that it never matters, and that, also, there are no (optional) named parameters in these methods.
It’d be nice to know if this is actually documented somewhere, and if I’ve got this right.
Source: Python Questions