summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipapp.py
diff options
context:
space:
mode:
authorhfinucane <h.finucane+gh@gmail.com>2022-05-27 16:04:29 (GMT)
committerGitHub <noreply@github.com>2022-05-27 16:04:29 (GMT)
commit47e68d451586541259ffb6ae29e948d4ea67c059 (patch)
treecc008a3ed0d440920ccc1ee2d884e01c54861ab4 /Lib/test/test_zipapp.py
parentbbcf42449e13c0b62f145cd49d12674ef3d5bf64 (diff)
downloadcpython-47e68d451586541259ffb6ae29e948d4ea67c059.zip
cpython-47e68d451586541259ffb6ae29e948d4ea67c059.tar.gz
cpython-47e68d451586541259ffb6ae29e948d4ea67c059.tar.bz2
bpo-46951: Order contents of zipapps (GH-31713)
So that builds are more reproducible.
Diffstat (limited to 'Lib/test/test_zipapp.py')
-rw-r--r--Lib/test/test_zipapp.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_zipapp.py b/Lib/test/test_zipapp.py
index 69f2e55..d135c68 100644
--- a/Lib/test/test_zipapp.py
+++ b/Lib/test/test_zipapp.py
@@ -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.