(self)
| 157 | |
| 158 | @requires_zlib() |
| 159 | def test_create_archive_with_compression(self): |
| 160 | # Test packing a directory into a compressed archive. |
| 161 | source = self.tmpdir / 'source' |
| 162 | source.mkdir() |
| 163 | (source / '__main__.py').touch() |
| 164 | (source / 'test.py').touch() |
| 165 | target = self.tmpdir / 'source.pyz' |
| 166 | |
| 167 | zipapp.create_archive(source, target, compressed=True) |
| 168 | with zipfile.ZipFile(target, 'r') as z: |
| 169 | for name in ('__main__.py', 'test.py'): |
| 170 | self.assertEqual(z.getinfo(name).compress_type, |
| 171 | zipfile.ZIP_DEFLATED) |
| 172 | |
| 173 | def test_no_main(self): |
| 174 | # Test that packing a directory with no __main__.py fails. |
nothing calls this directly
no test coverage detected