summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-09-07 10:55:25 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-09-07 10:55:25 (GMT)
commita091a8221e78eb4005ebd8e32f8fcb998f7b19c8 (patch)
tree166f85d21150022ad9697effa61882332474c1cd
parentb41eadab436ce08724f2373586bef52b13839014 (diff)
downloadcpython-a091a8221e78eb4005ebd8e32f8fcb998f7b19c8.zip
cpython-a091a8221e78eb4005ebd8e32f8fcb998f7b19c8.tar.gz
cpython-a091a8221e78eb4005ebd8e32f8fcb998f7b19c8.tar.bz2
Explicitly test archive name in shutil.make_archive() tests to expose failure
details in issue25018.
-rw-r--r--Lib/test/test_shutil.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index 8fc4562..cdc059b 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -974,10 +974,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:
@@ -986,9 +986,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:
@@ -1022,10 +1021,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`
@@ -1039,13 +1038,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