(self)
| 1811 | |
| 1812 | @support.requires_zlib() |
| 1813 | def test_make_zipfile_without_rootdir(self): |
| 1814 | root_dir, base_dir = self._create_files() |
| 1815 | # Test without base_dir. |
| 1816 | base_name = os.path.join(self.mkdtemp(), 'dst', 'archive') |
| 1817 | base_name = os.path.relpath(base_name, root_dir) |
| 1818 | with os_helper.change_cwd(root_dir), no_chdir: |
| 1819 | archive = make_archive(base_name, 'zip') |
| 1820 | self.assertEqual(archive, base_name + '.zip') |
| 1821 | self.assertTrue(os.path.isfile(archive)) |
| 1822 | self.assertTrue(zipfile.is_zipfile(archive)) |
| 1823 | with zipfile.ZipFile(archive) as zf: |
| 1824 | self.assertCountEqual(zf.namelist(), |
| 1825 | ['dist/', 'dist/sub/', 'dist/sub2/', |
| 1826 | 'dist/file1', 'dist/file2', 'dist/sub/file3', |
| 1827 | 'outer']) |
| 1828 | |
| 1829 | # Test with base_dir. |
| 1830 | root_dir, base_dir = self._create_files() |
| 1831 | with os_helper.change_cwd(root_dir), no_chdir: |
| 1832 | base_name = os.path.join('dst', 'archive') |
| 1833 | archive = make_archive(base_name, 'zip', base_dir=base_dir) |
| 1834 | self.assertEqual(archive, base_name + '.zip') |
| 1835 | self.assertTrue(os.path.isfile(archive)) |
| 1836 | self.assertTrue(zipfile.is_zipfile(archive)) |
| 1837 | with zipfile.ZipFile(archive) as zf: |
| 1838 | self.assertCountEqual(zf.namelist(), |
| 1839 | ['dist/', 'dist/sub/', 'dist/sub2/', |
| 1840 | 'dist/file1', 'dist/file2', 'dist/sub/file3']) |
| 1841 | |
| 1842 | @support.requires_zlib() |
| 1843 | def test_make_zipfile_with_explicit_curdir(self): |
nothing calls this directly
no test coverage detected