From: Tarek Ziadé Date: Mon, 18 May 2009 08:20:55 +0000 (+0000) Subject: working with relative paths to avoid tar warnings on absolute paths X-Git-Tag: v2.7a1~1155 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6deb574be3d3acfe7a4c016bb19fde7a4661a861;p=python working with relative paths to avoid tar warnings on absolute paths --- diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test_archive_util.py index 3e1e04a75f..1c88457d01 100644 --- a/Lib/distutils/tests/test_archive_util.py +++ b/Lib/distutils/tests/test_archive_util.py @@ -27,7 +27,14 @@ class ArchiveUtilTestCase(support.TempdirManager, tmpdir2 = self.mkdtemp() base_name = os.path.join(tmpdir2, 'archive') - make_tarball(base_name, tmpdir) + + # working with relative paths to avoid tar warnings + old_dir = os.getcwd() + os.chdir(tmpdir) + try: + make_tarball(base_name, '.') + finally: + os.chdir(old_dir) # check if the compressed tarball was created tarball = base_name + '.tar.gz' @@ -35,7 +42,12 @@ class ArchiveUtilTestCase(support.TempdirManager, # trying an uncompressed one base_name = os.path.join(tmpdir2, 'archive') - make_tarball(base_name, tmpdir, compress=None) + old_dir = os.getcwd() + os.chdir(tmpdir) + try: + make_tarball(base_name, '.', compress=None) + finally: + os.chdir(old_dir) tarball = base_name + '.tar' self.assert_(os.path.exists(tarball))