diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-21 12:09:26 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-21 12:09:26 (GMT) |
commit | b42de2f30985f68983eeb2f1734a22a59c47d1cf (patch) | |
tree | ce493826bff654629678f37f0b91f484629cde59 /Lib/test/test_shutil.py | |
parent | e1b02e045921b60be0997c133033ecd21d642e89 (diff) | |
download | cpython-b42de2f30985f68983eeb2f1734a22a59c47d1cf.zip cpython-b42de2f30985f68983eeb2f1734a22a59c47d1cf.tar.gz cpython-b42de2f30985f68983eeb2f1734a22a59c47d1cf.tar.bz2 |
Issue #25686: test_shutil no longer uses the distutils package for searching
and running external archivers.
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r-- | Lib/test/test_shutil.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 26a3eae..673d36b 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -12,8 +12,6 @@ import errno import functools import subprocess from contextlib import ExitStack -from os.path import splitdrive -from distutils.spawn import find_executable, spawn from shutil import (make_archive, register_archive_format, unregister_archive_format, get_archive_formats, Error, unpack_archive, @@ -45,7 +43,7 @@ try: import zipfile ZIP_SUPPORT = True except ImportError: - ZIP_SUPPORT = find_executable('zip') + ZIP_SUPPORT = shutil.which('zip') def _fake_rename(*args, **kwargs): # Pretend the destination path is on a different filesystem. @@ -1017,7 +1015,7 @@ class TestShutil(unittest.TestCase): return root_dir, base_dir @requires_zlib - @unittest.skipUnless(find_executable('tar'), + @unittest.skipUnless(shutil.which('tar'), 'Need the tar command to run') def test_tarfile_vs_tar(self): root_dir, base_dir = self._create_files() @@ -1031,8 +1029,8 @@ class TestShutil(unittest.TestCase): # now create another tarball using `tar` tarball2 = os.path.join(root_dir, 'archive2.tar') tar_cmd = ['tar', '-cf', 'archive2.tar', base_dir] - with support.change_cwd(root_dir): - spawn(tar_cmd) + subprocess.check_call(tar_cmd, cwd=root_dir, + stdout=subprocess.DEVNULL) self.assertTrue(os.path.isfile(tarball2)) # let's compare both tarballs @@ -1076,7 +1074,7 @@ class TestShutil(unittest.TestCase): @requires_zlib @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') - @unittest.skipUnless(find_executable('zip'), + @unittest.skipUnless(shutil.which('zip'), 'Need the zip command to run') def test_zipfile_vs_zip(self): root_dir, base_dir = self._create_files() @@ -1090,8 +1088,8 @@ class TestShutil(unittest.TestCase): # now create another ZIP file using `zip` archive2 = os.path.join(root_dir, 'archive2.zip') zip_cmd = ['zip', '-q', '-r', 'archive2.zip', base_dir] - with support.change_cwd(root_dir): - spawn(zip_cmd) + subprocess.check_call(zip_cmd, cwd=root_dir, + stdout=subprocess.DEVNULL) self.assertTrue(os.path.isfile(archive2)) # let's compare both ZIP files |