Repository navigation
Conversation
test_threaded_write and test_threaded_write_oversized_block_no_error never removed their NamedTemporaryFile(delete=False) files. BaseTest in test_gzip_compliance.py created a file in __init__(), but pytest creates TestCase instances while it collects tests, and only the instances that ran a test removed their file. test_repr and test_seek removed their files only when they passed. Use tmp_path, and create the file name in setUp().
tmp_path for the temporary files that the tests leave behind
1 of 2 tasks
pytest 10 turns the PytestRemovedIn10Warning for iterators into an error. pycompression#297 changes the other calls, but this decorator is next to the line that the previous commit changes.
This branch has not been deployed
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.
A full test run leaves 11 files in the temporary directory:
NamedTemporaryFile(delete=False)intest_threaded_writeandtest_threaded_write_oversized_block_no_error.BaseTest.__init__()intests/test_gzip_compliance.py. Since pytest 8.2, pytest creates theTestCaseinstances while it collects tests, plus one instance for each class that never runs a test. Only the instances that run a test remove their file.The two threaded tests now use
tmp_path, andBaseTestcreates its file name insetUp().test_reprandtest_seekintests/test_igzip.pyremoved their files only when they passed, so they usetmp_pathtoo. With this PR, the tests leave files only in thetmp_pathdirectories, and pytest keeps those for the last three runs only.The second commit passes a list instead of an
itertools.productiterator toparametrizefortest_threaded_write, as #297 does for the other tests. It is here because this PR changes the next line.This PR changes only tests, so it has no CHANGELOG entry.
Checklist