| 41 | self.assertTrue(target.is_file()) |
| 42 | |
| 43 | def test_create_archive_with_subdirs(self): |
| 44 | # Test packing a directory includes entries for subdirectories. |
| 45 | source = self.tmpdir / 'source' |
| 46 | source.mkdir() |
| 47 | (source / '__main__.py').touch() |
| 48 | (source / 'foo').mkdir() |
| 49 | (source / 'bar').mkdir() |
| 50 | (source / 'foo' / '__init__.py').touch() |
| 51 | target = io.BytesIO() |
| 52 | zipapp.create_archive(str(source), target) |
| 53 | target.seek(0) |
| 54 | with zipfile.ZipFile(target, 'r') as z: |
| 55 | self.assertIn('foo/', z.namelist()) |
| 56 | self.assertIn('bar/', z.namelist()) |
| 57 | |
| 58 | def test_create_sorted_archive(self): |
| 59 | # Test that zipapps order their files by name |