Open phnmn opened 9 months ago
Thanks @phnmn for reporting this issue !
I guess that pytest-rerunfailures does not change the test node id when re-running tests ? Indeed we currently have a protection against the same node id trying to save data twice:
Should we issue a warning and allow overwriting previous run's saved data ? This seems risky but maybe it is not, after all ?
@smarie, thank you for you response. I can't figure out what case you want to avoid with this protection. In my project I found a workaround for this by using a custom storage implementation.
class HarvestStoreMockDict(OrderedDict):
def __contains__(self, item):
return False
HARVEST_STORE = HarvestStoreMockDict()
@pytest.fixture(scope="session")
@saved_fixture(HARVEST_STORE)
def some_fixture():
...
And I didn't encounter any problems during this time.
I can't figure out what case you want to avoid with this protection.
I think that this was more of a way for me to check that the storage logic was indeed creating a distinct slot for each test node. Now that the plugin has been around for years, I know that this was the case :)
So we could remove the protection and instead overwrite the previously saved contents. Would you like to propose a PR for this ?
When test runs with reruns pytest plugin (eg pytest-rerunfailures) failed test will become broken with "already stored" error:
example of test_rerun_harvets.py
and run test with 2 reruns
installed deps: