(self)
| 2109 | |
| 2110 | @support.requires_zlib() |
| 2111 | def test_make_zipfile_rootdir_nodir(self): |
| 2112 | # GH-99203: Test with root_dir is not a real directory. |
| 2113 | self.addCleanup(os_helper.unlink, f'{TESTFN}.zip') |
| 2114 | for dry_run in (False, True): |
| 2115 | with self.subTest(dry_run=dry_run): |
| 2116 | # root_dir does not exist. |
| 2117 | tmp_dir = self.mkdtemp() |
| 2118 | nonexisting_file = os.path.join(tmp_dir, 'nonexisting') |
| 2119 | with self.assertRaises(FileNotFoundError) as cm: |
| 2120 | make_archive(TESTFN, 'zip', nonexisting_file, dry_run=dry_run) |
| 2121 | self.assertEqual(cm.exception.errno, errno.ENOENT) |
| 2122 | self.assertEqual(cm.exception.filename, nonexisting_file) |
| 2123 | self.assertFalse(os.path.exists(f'{TESTFN}.zip')) |
| 2124 | |
| 2125 | # root_dir is a file. |
| 2126 | tmp_fd, tmp_file = tempfile.mkstemp(dir=tmp_dir) |
| 2127 | os.close(tmp_fd) |
| 2128 | with self.assertRaises(NotADirectoryError) as cm: |
| 2129 | make_archive(TESTFN, 'zip', tmp_file, dry_run=dry_run) |
| 2130 | self.assertEqual(cm.exception.errno, errno.ENOTDIR) |
| 2131 | self.assertEqual(cm.exception.filename, tmp_file) |
| 2132 | self.assertFalse(os.path.exists(f'{TESTFN}.zip')) |
| 2133 | |
| 2134 | ### shutil.unpack_archive |
| 2135 |
nothing calls this directly
no test coverage detected