(self, format, converter, **kwargs)
| 2141 | self.check_unpack_archive_with_converter(format, FakePath, **kwargs) |
| 2142 | |
| 2143 | def check_unpack_archive_with_converter(self, format, converter, **kwargs): |
| 2144 | root_dir, base_dir = self._create_files() |
| 2145 | expected = rlistdir(root_dir) |
| 2146 | expected.remove('outer') |
| 2147 | |
| 2148 | base_name = os.path.join(self.mkdtemp(), 'archive') |
| 2149 | filename = make_archive(base_name, format, root_dir, base_dir) |
| 2150 | |
| 2151 | # let's try to unpack it now |
| 2152 | tmpdir2 = self.mkdtemp() |
| 2153 | unpack_archive(converter(filename), converter(tmpdir2), **kwargs) |
| 2154 | self.assertEqual(rlistdir(tmpdir2), expected) |
| 2155 | |
| 2156 | # and again, this time with the format specified |
| 2157 | tmpdir3 = self.mkdtemp() |
| 2158 | unpack_archive(converter(filename), converter(tmpdir3), format=format, |
| 2159 | **kwargs) |
| 2160 | self.assertEqual(rlistdir(tmpdir3), expected) |
| 2161 | |
| 2162 | with self.assertRaises(shutil.ReadError): |
| 2163 | unpack_archive(converter(TESTFN), **kwargs) |
| 2164 | with self.assertRaises(ValueError): |
| 2165 | unpack_archive(converter(TESTFN), format='xxx', **kwargs) |
| 2166 | |
| 2167 | def check_unpack_tarball(self, format): |
| 2168 | self.check_unpack_archive(format, filter='fully_trusted') |
no test coverage detected