{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Update the zipfile + zipimport libraries + tests - v3.13.11 #6639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
youknowone
merged 5 commits into
RustPython:main
from
terryluan12:update_zipfile_zipimport
Jan 6, 2026
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0f893ec
Updated zipimport library + test
terryluan12 d7d04da
Updated zipfile library + test
terryluan12 f94cb62
Annotated failing/erroring tests in test_zipfile and test_zipimport
terryluan12 62074b7
Changed all skips in `test_core.py` to expectedFailures
terryluan12 b68b623
skip EncodedMetadataTests
youknowone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Annotated failing/erroring tests in test_zipfile and test_zipimport
- Loading branch information
commit f94cb6229c32150b67cdad2f2e3a7ea732c79357
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3440,8 +3440,10 @@ class EncodedMetadataTests(unittest.TestCase): | |
| "This is pure ASCII.\n".encode('ascii'), | ||
| # This is modern Japanese. (UTF-8) | ||
| "\u3053\u308c\u306f\u73fe\u4ee3\u7684\u65e5\u672c\u8a9e\u3067\u3059\u3002\n".encode('utf-8'), | ||
| # TODO RUSTPYTHON | ||
| # Uncomment when Shift JIS is supported | ||
| # This is obsolete Japanese. (Shift JIS) | ||
| "\u3053\u308c\u306f\u53e4\u3044\u65e5\u672c\u8a9e\u3067\u3059\u3002\n".encode('shift_jis'), | ||
| # "\u3053\u308c\u306f\u53e4\u3044\u65e5\u672c\u8a9e\u3067\u3059\u3002\n".encode('shift_jis'), | ||
| ] | ||
|
|
||
| def setUp(self): | ||
|
|
@@ -3481,25 +3483,29 @@ def _test_read(self, zipfp, expected_names, expected_content): | |
| self.assertEqual(info.file_size, len(content)) | ||
| self.assertEqual(zipfp.read(name), content) | ||
|
|
||
| @unittest.skip('TODO: RUSTPYTHON') | ||
| def test_read_with_metadata_encoding(self): | ||
| # Read the ZIP archive with correct metadata_encoding | ||
| with zipfile.ZipFile(TESTFN, "r", metadata_encoding='shift_jis') as zipfp: | ||
| self._test_read(zipfp, self.file_names, self.file_content) | ||
|
|
||
| @unittest.skip('TODO: RUSTPYTHON') | ||
| def test_read_without_metadata_encoding(self): | ||
| # Read the ZIP archive without metadata_encoding | ||
| expected_names = [name.encode('shift_jis').decode('cp437') | ||
| for name in self.file_names[:2]] + self.file_names[2:] | ||
| with zipfile.ZipFile(TESTFN, "r") as zipfp: | ||
| self._test_read(zipfp, expected_names, self.file_content) | ||
|
|
||
| @unittest.skip('TODO: RUSTPYTHON') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These skips too. Actually, I'd like to entirely remove skip in this patch. Usually we avoid skip because it hides bugs and problems. If it still fails, I will append the reason what justify skip |
||
| def test_read_with_incorrect_metadata_encoding(self): | ||
| # Read the ZIP archive with incorrect metadata_encoding | ||
| expected_names = [name.encode('shift_jis').decode('koi8-u') | ||
| for name in self.file_names[:2]] + self.file_names[2:] | ||
| with zipfile.ZipFile(TESTFN, "r", metadata_encoding='koi8-u') as zipfp: | ||
| self._test_read(zipfp, expected_names, self.file_content) | ||
|
|
||
| @unittest.skip('TODO: RUSTPYTHON') | ||
| def test_read_with_unsuitable_metadata_encoding(self): | ||
| # Read the ZIP archive with metadata_encoding unsuitable for | ||
| # decoding metadata | ||
|
|
@@ -3508,6 +3514,7 @@ def test_read_with_unsuitable_metadata_encoding(self): | |
| with self.assertRaises(UnicodeDecodeError): | ||
| zipfile.ZipFile(TESTFN, "r", metadata_encoding='utf-8') | ||
|
|
||
| @unittest.skip('TODO: RUSTPYTHON') | ||
| def test_read_after_append(self): | ||
| newname = '\u56db' # Han 'four' | ||
| expected_names = [name.encode('shift_jis').decode('cp437') | ||
|
|
@@ -3534,13 +3541,15 @@ def test_read_after_append(self): | |
| else: | ||
| self.assertEqual(zipfp.read(name), content) | ||
|
|
||
| @unittest.skip('TODO: RUSTPYTHON') | ||
| def test_write_with_metadata_encoding(self): | ||
| ZF = zipfile.ZipFile | ||
| for mode in ("w", "x", "a"): | ||
| with self.assertRaisesRegex(ValueError, | ||
| "^metadata_encoding is only"): | ||
| ZF("nonesuch.zip", mode, metadata_encoding="shift_jis") | ||
|
|
||
| @unittest.skip('TODO: RUSTPYTHON') | ||
| def test_cli_with_metadata_encoding(self): | ||
| errmsg = "Non-conforming encodings not supported with -c." | ||
| args = ["--metadata-encoding=shift_jis", "-c", "nonesuch", "nonesuch"] | ||
|
|
@@ -3560,6 +3569,7 @@ def test_cli_with_metadata_encoding(self): | |
| for name in self.file_names: | ||
| self.assertIn(name, listing) | ||
|
|
||
| @unittest.skip('TODO: RUSTPYTHON') | ||
| def test_cli_with_metadata_encoding_extract(self): | ||
| os.mkdir(TESTFN2) | ||
| self.addCleanup(rmtree, TESTFN2) | ||
|
|
||
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
Oops, something went wrong.
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.
You can’t perform that action at this time.

Uh oh!
There was an error while loading. Please reload this page.