Open
Conversation
Document that `failed`` removes the files of passing tests in the teardown step but `none` only removes the files of tests at the end of the test session.
cfcadf3 to
c57f5bb
Compare
webknjaz
reviewed
Feb 11, 2026
webknjaz
reviewed
Feb 11, 2026
webknjaz
reviewed
Feb 11, 2026
05df092 to
a5cdffa
Compare
Member
|
Wait dir retention of none should be dropping them |
Author
@RonnyPfannschmidt the logic here https://github.com/pytest-dev/pytest/blob/main/src/_pytest/tmpdir.py#L274 only removes files if retention policy is explicitly set to failed. If the policy is set to none the files are removed by the atexit finalizer defined here https://github.com/pytest-dev/pytest/blob/main/src/_pytest/pathlib.py#L398 but that will not execute until the session ends If that is unintentional it would also be a possibility to change that and drop this pr. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While debugging a test session that ran out of diskspace in CI tried different retention policies. From reading the docs I would have expected that both
failedandnonewould remove tmp files during teardown of the test but reading the code and testing locally I can see that whennoneis used the fixtures are not removed until the end of the session.This PR tweaks the docs slightly to make that clearer by documenting that
failedremoves the files of passing tests in the teardown step butnoneonly removes the files of tests at the end of the test session.