| 56 | self.assertIn('bar/', z.namelist()) |
| 57 | |
| 58 | def test_create_sorted_archive(self): |
| 59 | # Test that zipapps order their files by name |
| 60 | source = self.tmpdir / 'source' |
| 61 | source.mkdir() |
| 62 | (source / 'zed.py').touch() |
| 63 | (source / 'bin').mkdir() |
| 64 | (source / 'bin' / 'qux').touch() |
| 65 | (source / 'bin' / 'baz').touch() |
| 66 | (source / '__main__.py').touch() |
| 67 | target = io.BytesIO() |
| 68 | zipapp.create_archive(str(source), target) |
| 69 | target.seek(0) |
| 70 | with zipfile.ZipFile(target, 'r') as zf: |
| 71 | self.assertEqual(zf.namelist(), |
| 72 | ["__main__.py", "bin/", "bin/baz", "bin/qux", "zed.py"]) |
| 73 | |
| 74 | def test_create_archive_with_filter(self): |
| 75 | # Test packing a directory and using filter to specify |