MCPcopy Create free account
hub / github.com/python/cpython / check_unpack_archive_with_converter

Method check_unpack_archive_with_converter

Lib/test/test_shutil.py:2143–2165  ·  view source on GitHub ↗
(self, format, converter, **kwargs)

Source from the content-addressed store, hash-verified

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')

Callers 1

check_unpack_archiveMethod · 0.95

Calls 9

_create_filesMethod · 0.95
make_archiveFunction · 0.90
unpack_archiveFunction · 0.90
rlistdirFunction · 0.85
mkdtempMethod · 0.80
removeMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected