smarie / python-pytest-harvest

Store data created during your `pytest` tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes.
https://smarie.github.io/python-pytest-harvest/
BSD 3-Clause "New" or "Revised" License
62 stars 9 forks source link

Fixture parameters returned by `get_session_synthesis_dct` conflict with fixture instances saved. #15

Closed smarie closed 5 years ago

smarie commented 5 years ago

If we have a saved fixture with parameters

@pytest.fixture(params=range(2))
@saved_fixture
def person(request):
    if request.param == 0:
        return "world"
    elif request.param == 1:
        return "self"

Then using get_session_synthesis_dct with flatten=True, will overwrite the fixture parameters with the fixture values:

def test_failing(request, fixture_store):
    dct = get_session_synthesis_dct(request, filter=test_foo, flatten=True, fixture_store=fixture_store)
    # we can see that dct does not contain the fixture parameters any more, only the fixture values.
smarie commented 5 years ago

Proposal to solve this: the fixture parameters should be available under name <fixture_param> both in flatten an non-flatten mode.