mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-46951: Order contents of zipapps (GH-31713)
So that builds are more reproducible.
This commit is contained in:
parent
bbcf42449e
commit
47e68d4515
3 changed files with 18 additions and 1 deletions
|
@ -54,6 +54,22 @@ class ZipAppTest(unittest.TestCase):
|
|||
self.assertIn('foo/', z.namelist())
|
||||
self.assertIn('bar/', z.namelist())
|
||||
|
||||
def test_create_sorted_archive(self):
|
||||
# Test that zipapps order their files by name
|
||||
source = self.tmpdir / 'source'
|
||||
source.mkdir()
|
||||
(source / 'zed.py').touch()
|
||||
(source / 'bin').mkdir()
|
||||
(source / 'bin' / 'qux').touch()
|
||||
(source / 'bin' / 'baz').touch()
|
||||
(source / '__main__.py').touch()
|
||||
target = io.BytesIO()
|
||||
zipapp.create_archive(str(source), target)
|
||||
target.seek(0)
|
||||
with zipfile.ZipFile(target, 'r') as zf:
|
||||
self.assertEqual(zf.namelist(),
|
||||
["__main__.py", "bin/", "bin/baz", "bin/qux", "zed.py"])
|
||||
|
||||
def test_create_archive_with_filter(self):
|
||||
# Test packing a directory and using filter to specify
|
||||
# which files to include.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue