Tmpdir stash key deletion question #13095
Replies: 5 comments 1 reply
-
For reference, it looks like the stash check was added to fix a crash with the fixture in this PR: #10517 |
Beta Was this translation helpful? Give feedback.
-
Probably just to avoid keeping around data with every test that isn't needed anywhere anymore? Maybe @ykadowak who originally implemented this can say more. |
Beta Was this translation helpful? Give feedback.
-
Thanks, that'd be great! I've been maintaining a test retry plugin for Pytest that runs into an exception with the tmpdir fixture teardown and removing the stash key deletion line would fix it (but I was curious if there would be side effects). I could provide an alternative fixture or insert a dummy dict with the stash key if needed, but if the only purpose to that line is to avoid keeping data around, is there any chance it could be removed? |
Beta Was this translation helpful? Give feedback.
-
Disclaimer: Honestly, I've been away from Python for a pretty long time, so my memory is quite vague...
As far as I can remember, the reason is just this. So it might be okay to remove this line. However, there's some concerns:
|
Beta Was this translation helpful? Give feedback.
-
Thanks @ykadowak, appreciate you coming back to coming back to take a look at this. To be clear, I'm not trying to use the dict myself, the current implementation just means that during the initial teardown stage, the dict is deleted and so the tmpdir fixture fails when trying to access it during retries. Since the dict is added to items during the report stage (where the main portion of my plugin runs), the value is never refreshed for subsequent runs of the fixture. The fixture is just essentially getting in its own way. I don't wish to rock the boat here so if this feature hasn't been reasoned about recently and possesses limited test coverage, I'm inclined to just proceed with a workaround and/or disclaimer on my end. There's always pytest-rerunfailures, which doesn't exhibit this issue, as an alternative. |
Beta Was this translation helpful? Give feedback.
-
Q: What is the reason for deleting the stashed result dict from each request in the
tmp_path
fixture from_pytest/tmpdir.py
?Context: The tmp_path fixture uses the following code to determine whether to run
rmtree()
during teardown:This result dict gets added during the runtest_makereport stage. Deleting entries from the stash doesn't seem to be particularly common and isn't directly required for the file cleanup here, so I'm curious if there's a subtler reason I'm not understanding. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions