diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-09-07 10:56:49 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-09-07 10:56:49 (GMT) |
commit | 8c85a2083fdc6188d32f1eb287151cdb7e79a54a (patch) | |
tree | a8fab0ca034ebefb25f7d915cd2ecb4ff688d217 /Lib/test/test_shutil.py | |
parent | ffcff22ade25f8ef701bd4d7a1e72e1337abbd3a (diff) | |
parent | a091a8221e78eb4005ebd8e32f8fcb998f7b19c8 (diff) | |
download | cpython-8c85a2083fdc6188d32f1eb287151cdb7e79a54a.zip cpython-8c85a2083fdc6188d32f1eb287151cdb7e79a54a.tar.gz cpython-8c85a2083fdc6188d32f1eb287151cdb7e79a54a.tar.bz2 |
Explicitly test archive name in shutil.make_archive() tests to expose failure
details in issue25018.
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r-- | Lib/test/test_shutil.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 1c14b5c..9e52191 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -980,10 +980,10 @@ class TestShutil(unittest.TestCase): base_name = os.path.join(tmpdir2, 'archive') # working with relative paths to avoid tar warnings - make_archive(splitdrive(base_name)[1], 'gztar', root_dir, '.') + tarball = make_archive(splitdrive(base_name)[1], 'gztar', root_dir, '.') # check if the compressed tarball was created - tarball = base_name + '.tar.gz' + self.assertEqual(tarball, base_name + '.tar.gz') self.assertTrue(os.path.isfile(tarball)) self.assertTrue(tarfile.is_tarfile(tarball)) with tarfile.open(tarball, 'r:gz') as tf: @@ -992,9 +992,8 @@ class TestShutil(unittest.TestCase): './file1', './file2', './sub/file3']) # trying an uncompressed one - base_name = os.path.join(tmpdir2, 'archive') - make_archive(splitdrive(base_name)[1], 'tar', root_dir, '.') - tarball = base_name + '.tar' + tarball = make_archive(splitdrive(base_name)[1], 'tar', root_dir, '.') + self.assertEqual(tarball, base_name + '.tar') self.assertTrue(os.path.isfile(tarball)) self.assertTrue(tarfile.is_tarfile(tarball)) with tarfile.open(tarball, 'r') as tf: @@ -1028,10 +1027,10 @@ class TestShutil(unittest.TestCase): def test_tarfile_vs_tar(self): root_dir, base_dir = self._create_files() base_name = os.path.join(self.mkdtemp(), 'archive') - make_archive(base_name, 'gztar', root_dir, base_dir) + tarball = make_archive(base_name, 'gztar', root_dir, base_dir) # check if the compressed tarball was created - tarball = base_name + '.tar.gz' + self.assertEqual(tarball, base_name + '.tar.gz') self.assertTrue(os.path.isfile(tarball)) # now create another tarball using `tar` @@ -1045,13 +1044,14 @@ class TestShutil(unittest.TestCase): self.assertEqual(self._tarinfo(tarball), self._tarinfo(tarball2)) # trying an uncompressed one - make_archive(base_name, 'tar', root_dir, base_dir) - tarball = base_name + '.tar' + tarball = make_archive(base_name, 'tar', root_dir, base_dir) + self.assertEqual(tarball, base_name + '.tar') self.assertTrue(os.path.isfile(tarball)) # now for a dry_run - make_archive(base_name, 'tar', root_dir, base_dir, dry_run=True) - tarball = base_name + '.tar' + tarball = make_archive(base_name, 'tar', root_dir, base_dir, + dry_run=True) + self.assertEqual(tarball, base_name + '.tar') self.assertTrue(os.path.isfile(tarball)) @requires_zlib |