Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a6023d

Browse files
Fixed tests for shutil.make_archive() with relative base_name in the case when
the path of the directory for temporary files contains symlinks.
2 parents 4da050a + 050a143 commit 8a6023d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/test/test_shutil.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,9 +977,9 @@ def test_make_tarball(self):
977977
# working with relative paths
978978
work_dir = os.path.dirname(tmpdir2)
979979
rel_base_name = os.path.join(os.path.basename(tmpdir2), 'archive')
980-
base_name = os.path.join(work_dir, rel_base_name)
981980

982981
with support.change_cwd(work_dir):
982+
base_name = os.path.abspath(rel_base_name)
983983
tarball = make_archive(rel_base_name, 'gztar', root_dir, '.')
984984

985985
# check if the compressed tarball was created
@@ -1067,9 +1067,9 @@ def test_make_zipfile(self):
10671067
# working with relative paths
10681068
work_dir = os.path.dirname(tmpdir2)
10691069
rel_base_name = os.path.join(os.path.basename(tmpdir2), 'archive')
1070-
base_name = os.path.join(work_dir, rel_base_name)
10711070

10721071
with support.change_cwd(work_dir):
1072+
base_name = os.path.abspath(rel_base_name)
10731073
res = make_archive(rel_base_name, 'zip', root_dir, base_dir)
10741074

10751075
self.assertEqual(res, base_name + '.zip')

0 commit comments

Comments
 (0)