mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
bpo-34738: Add directory entries in ZIP files created by distutils. (GH-9419)
This commit is contained in:
parent
55f41e45b4
commit
67a93b3a0b
5 changed files with 27 additions and 10 deletions
|
@ -122,12 +122,13 @@ class ArchiveUtilTestCase(support.TempdirManager,
|
|||
try:
|
||||
names = tar.getnames()
|
||||
names.sort()
|
||||
return tuple(names)
|
||||
return names
|
||||
finally:
|
||||
tar.close()
|
||||
|
||||
_created_files = ('dist', 'dist/file1', 'dist/file2',
|
||||
'dist/sub', 'dist/sub/file3', 'dist/sub2')
|
||||
_zip_created_files = ['dist/', 'dist/file1', 'dist/file2',
|
||||
'dist/sub/', 'dist/sub/file3', 'dist/sub2/']
|
||||
_created_files = [p.rstrip('/') for p in _zip_created_files]
|
||||
|
||||
def _create_files(self):
|
||||
# creating something to tar
|
||||
|
@ -244,8 +245,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
|
|||
tarball = base_name + '.zip'
|
||||
self.assertTrue(os.path.exists(tarball))
|
||||
with zipfile.ZipFile(tarball) as zf:
|
||||
self.assertEqual(sorted(zf.namelist()),
|
||||
['dist/file1', 'dist/file2', 'dist/sub/file3'])
|
||||
self.assertEqual(sorted(zf.namelist()), self._zip_created_files)
|
||||
|
||||
@unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run')
|
||||
def test_make_zipfile_no_zlib(self):
|
||||
|
@ -271,8 +271,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
|
|||
[((tarball, "w"), {'compression': zipfile.ZIP_STORED})])
|
||||
self.assertTrue(os.path.exists(tarball))
|
||||
with zipfile.ZipFile(tarball) as zf:
|
||||
self.assertEqual(sorted(zf.namelist()),
|
||||
['dist/file1', 'dist/file2', 'dist/sub/file3'])
|
||||
self.assertEqual(sorted(zf.namelist()), self._zip_created_files)
|
||||
|
||||
def test_check_archive_formats(self):
|
||||
self.assertEqual(check_archive_formats(['gztar', 'xxx', 'zip']),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue