(self)
| 2085 | self.assertNotIn('xxx', formats) |
| 2086 | |
| 2087 | def test_make_tarfile_rootdir_nodir(self): |
| 2088 | # GH-99203: Test with root_dir is not a real directory. |
| 2089 | self.addCleanup(os_helper.unlink, f'{TESTFN}.tar') |
| 2090 | for dry_run in (False, True): |
| 2091 | with self.subTest(dry_run=dry_run): |
| 2092 | # root_dir does not exist. |
| 2093 | tmp_dir = self.mkdtemp() |
| 2094 | nonexisting_file = os.path.join(tmp_dir, 'nonexisting') |
| 2095 | with self.assertRaises(FileNotFoundError) as cm: |
| 2096 | make_archive(TESTFN, 'tar', nonexisting_file, dry_run=dry_run) |
| 2097 | self.assertEqual(cm.exception.errno, errno.ENOENT) |
| 2098 | self.assertEqual(cm.exception.filename, nonexisting_file) |
| 2099 | self.assertFalse(os.path.exists(f'{TESTFN}.tar')) |
| 2100 | |
| 2101 | # root_dir is a file. |
| 2102 | tmp_fd, tmp_file = tempfile.mkstemp(dir=tmp_dir) |
| 2103 | os.close(tmp_fd) |
| 2104 | with self.assertRaises(NotADirectoryError) as cm: |
| 2105 | make_archive(TESTFN, 'tar', tmp_file, dry_run=dry_run) |
| 2106 | self.assertEqual(cm.exception.errno, errno.ENOTDIR) |
| 2107 | self.assertEqual(cm.exception.filename, tmp_file) |
| 2108 | self.assertFalse(os.path.exists(f'{TESTFN}.tar')) |
| 2109 | |
| 2110 | @support.requires_zlib() |
| 2111 | def test_make_zipfile_rootdir_nodir(self): |
nothing calls this directly
no test coverage detected