mirror of https://github.com/python/cpython
Merge fix for #11548 from 3.2
This commit is contained in:
commit
7bfa67f380
|
@ -737,8 +737,8 @@ def unpack_archive(filename, extract_dir=None, format=None):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise ValueError("Unknown unpack format '{0}'".format(format))
|
raise ValueError("Unknown unpack format '{0}'".format(format))
|
||||||
|
|
||||||
func = format_info[0]
|
func = format_info[1]
|
||||||
func(filename, extract_dir, **dict(format_info[1]))
|
func(filename, extract_dir, **dict(format_info[2]))
|
||||||
else:
|
else:
|
||||||
# we need to look at the registered unpackers supported extensions
|
# we need to look at the registered unpackers supported extensions
|
||||||
format = _find_unpack_format(filename)
|
format = _find_unpack_format(filename)
|
||||||
|
|
|
@ -645,6 +645,14 @@ class TestShutil(unittest.TestCase):
|
||||||
diff = self._compare_dirs(tmpdir, tmpdir2)
|
diff = self._compare_dirs(tmpdir, tmpdir2)
|
||||||
self.assertEqual(diff, [])
|
self.assertEqual(diff, [])
|
||||||
|
|
||||||
|
# and again, this time with the format specified
|
||||||
|
tmpdir3 = self.mkdtemp()
|
||||||
|
unpack_archive(filename, tmpdir3, format=format)
|
||||||
|
diff = self._compare_dirs(tmpdir, tmpdir3)
|
||||||
|
self.assertEqual(diff, [])
|
||||||
|
self.assertRaises(shutil.ReadError, unpack_archive, TESTFN)
|
||||||
|
self.assertRaises(ValueError, unpack_archive, TESTFN, format='xxx')
|
||||||
|
|
||||||
def test_unpack_registery(self):
|
def test_unpack_registery(self):
|
||||||
|
|
||||||
formats = get_unpack_formats()
|
formats = get_unpack_formats()
|
||||||
|
|
Loading…
Reference in New Issue