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

Skip to content

Commit 5558d4f

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.
1 parent 8ba03cf commit 5558d4f

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
@@ -971,9 +971,9 @@ def test_make_tarball(self):
971971
# working with relative paths
972972
work_dir = os.path.dirname(tmpdir2)
973973
rel_base_name = os.path.join(os.path.basename(tmpdir2), 'archive')
974-
base_name = os.path.join(work_dir, rel_base_name)
975974

976975
with support.change_cwd(work_dir):
976+
base_name = os.path.abspath(rel_base_name)
977977
tarball = make_archive(rel_base_name, 'gztar', root_dir, '.')
978978

979979
# check if the compressed tarball was created
@@ -1061,9 +1061,9 @@ def test_make_zipfile(self):
10611061
# working with relative paths
10621062
work_dir = os.path.dirname(tmpdir2)
10631063
rel_base_name = os.path.join(os.path.basename(tmpdir2), 'archive')
1064-
base_name = os.path.join(work_dir, rel_base_name)
10651064

10661065
with support.change_cwd(work_dir):
1066+
base_name = os.path.abspath(rel_base_name)
10671067
res = make_archive(rel_base_name, 'zip', root_dir, base_dir)
10681068

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

0 commit comments

Comments
 (0)