I know it's impossible to add more tests inside fixtures because they run at test time, and tests are generated at collection time.
But I want to be able to generate parameters to a test based on the path to the test function (to the module where test function is).
Basically, I want something like that:
@pytest.mark.parametrize(
argnames='letter',
argvalues=lambda request: list(zip(request.fspath)),
indirect=True
)
def test_foo(letter):
assert letter
It should print put a path to the module, letter by letter as a parameter to the function:
foo[/]
foo[t]
foo[e]
foo[s]
foo[t]
foo[.]
foo[p]
foo[y]
This code (above) is definitively not working, but may be there is a way to use fspath as an argument to parametrize?