Repository navigation
Port test changes from CPython - #165
Merged
Merged
Conversation
(cherry picked from commit 561212a03306cb2f246771e9c4748bec1dc41405)
Zipfile tests: close file objects (cherry picked from commit 5cea8435943b4f9d22c89c80d86c2ba3b392c6f9)
Bring `zipfile.ZipFile` into alignment with other buffered file writers like `GzipFile` and `TextIOWrapper` by emitting a `ResourceWarning` if there is unwritten data and it is closed implicitly. ZipFile should be closed either by using it as a context manager or explicitly calling `.close()`. (cherry picked from commit 5e0c502799f3324b8a0776cacd6a3af5b62879b5)
The tests ported from CPython rely on unittest.TestCase.enterContext, added in Python 3.11.
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.
Ports the changes made to
zipfile.Path's tests in CPython since thezipp 3.23 sync, in preparation for merging zipp 4.1.1 downstream.
Cherry-picked from CPython
main:ZipFile.__del__warning itself is stdlib-side. These move the tests from anExitStackfixture toTestCase.enterContextand haveparameterizeenter/exit context-manager params.Plus one commit of my own:
TestCase.enterContextarrived in Python 3.11, so a shim lands intests/compat/py310for the Python 3.10 we still support.Tests pass on 3.10 and 3.14.
🤖 Generated with Claude Code