Skip to content

Commit fd8e30e

Browse files
authored
gh-112795: Move the test for ZipFile into the core tests for zipfile. (#116823)
Move the test for ZipFile into the core tests for zipfile.
1 parent 61e54bf commit fd8e30e

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

Lib/test/test_zipfile/_path/test_path.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -577,15 +577,3 @@ def test_getinfo_missing(self, alpharep):
577577
zipfile.Path(alpharep)
578578
with self.assertRaises(KeyError):
579579
alpharep.getinfo('does-not-exist')
580-
581-
def test_root_folder_in_zipfile(self):
582-
"""
583-
gh-112795: Some tools or self constructed codes will add '/' folder to
584-
the zip file, this is a strange behavior, but we should support it.
585-
"""
586-
in_memory_file = io.BytesIO()
587-
zf = zipfile.ZipFile(in_memory_file, "w")
588-
zf.mkdir('/')
589-
zf.writestr('./a.txt', 'aaa')
590-
tmpdir = pathlib.Path(self.fixtures.enter_context(temp_dir()))
591-
zf.extractall(tmpdir)

Lib/test/test_zipfile/test_core.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3033,6 +3033,17 @@ def test_create_directory_with_write(self):
30333033

30343034
self.assertEqual(set(os.listdir(target)), {"directory", "directory2"})
30353035

3036+
def test_root_folder_in_zipfile(self):
3037+
"""
3038+
gh-112795: Some tools or self constructed codes will add '/' folder to
3039+
the zip file, this is a strange behavior, but we should support it.
3040+
"""
3041+
in_memory_file = io.BytesIO()
3042+
zf = zipfile.ZipFile(in_memory_file, "w")
3043+
zf.mkdir('/')
3044+
zf.writestr('./a.txt', 'aaa')
3045+
zf.extractall(TESTFN2)
3046+
30363047
def tearDown(self):
30373048
rmtree(TESTFN2)
30383049
if os.path.exists(TESTFN):

0 commit comments

Comments
 (0)