diff options
author | Larry Hastings <larry@hastings.org> | 2015-11-23 07:27:07 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2015-11-23 07:27:07 (GMT) |
commit | 3715cab3cb6bc689c66e7aaaeb86fbf953fe0262 (patch) | |
tree | 2135159f044b692a6b8d22eef78b18d8b8e7cd43 /Lib/test/test_shutil.py | |
parent | ba11daa4e880e16d56ed02e7e14d95f3b2c44eaf (diff) | |
parent | 3987fefd6f7309a36fb093cbfe229afe7b39406b (diff) | |
download | cpython-3715cab3cb6bc689c66e7aaaeb86fbf953fe0262.zip cpython-3715cab3cb6bc689c66e7aaaeb86fbf953fe0262.tar.gz cpython-3715cab3cb6bc689c66e7aaaeb86fbf953fe0262.tar.bz2 |
Merge 3.5.1rc1 release changes back into main 3.5 branch.
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r-- | Lib/test/test_shutil.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 62036dd..ca1d006 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -1105,6 +1105,29 @@ class TestShutil(unittest.TestCase): names2 = zf.namelist() self.assertEqual(sorted(names), sorted(names2)) + @requires_zlib + @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') + @unittest.skipUnless(shutil.which('unzip'), + 'Need the unzip command to run') + def test_unzip_zipfile(self): + root_dir, base_dir = self._create_files() + base_name = os.path.join(self.mkdtemp(), 'archive') + archive = make_archive(base_name, 'zip', root_dir, base_dir) + + # check if ZIP file was created + self.assertEqual(archive, base_name + '.zip') + self.assertTrue(os.path.isfile(archive)) + + # now check the ZIP file using `unzip -t` + zip_cmd = ['unzip', '-t', archive] + with support.change_cwd(root_dir): + try: + subprocess.check_output(zip_cmd, stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as exc: + details = exc.output.decode(errors="replace") + msg = "{}\n\n**Unzip Output**\n{}" + self.fail(msg.format(exc, details)) + def test_make_archive(self): tmpdir = self.mkdtemp() base_name = os.path.join(tmpdir, 'archive') |