Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b42de2f3
Commit
b42de2f3
authored
Nov 21, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #25686: test_shutil no longer uses the distutils package for searching
and running external archivers.
parent
e1b02e04
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
Lib/test/test_shutil.py
Lib/test/test_shutil.py
+7
-9
No files found.
Lib/test/test_shutil.py
View file @
b42de2f3
...
@@ -12,8 +12,6 @@ import errno
...
@@ -12,8 +12,6 @@ import errno
import
functools
import
functools
import
subprocess
import
subprocess
from
contextlib
import
ExitStack
from
contextlib
import
ExitStack
from
os.path
import
splitdrive
from
distutils.spawn
import
find_executable
,
spawn
from
shutil
import
(
make_archive
,
from
shutil
import
(
make_archive
,
register_archive_format
,
unregister_archive_format
,
register_archive_format
,
unregister_archive_format
,
get_archive_formats
,
Error
,
unpack_archive
,
get_archive_formats
,
Error
,
unpack_archive
,
...
@@ -45,7 +43,7 @@ try:
...
@@ -45,7 +43,7 @@ try:
import
zipfile
import
zipfile
ZIP_SUPPORT
=
True
ZIP_SUPPORT
=
True
except
ImportError
:
except
ImportError
:
ZIP_SUPPORT
=
find_executable
(
'zip'
)
ZIP_SUPPORT
=
shutil
.
which
(
'zip'
)
def
_fake_rename
(
*
args
,
**
kwargs
):
def
_fake_rename
(
*
args
,
**
kwargs
):
# Pretend the destination path is on a different filesystem.
# Pretend the destination path is on a different filesystem.
...
@@ -1017,7 +1015,7 @@ class TestShutil(unittest.TestCase):
...
@@ -1017,7 +1015,7 @@ class TestShutil(unittest.TestCase):
return
root_dir
,
base_dir
return
root_dir
,
base_dir
@
requires_zlib
@
requires_zlib
@
unittest
.
skipUnless
(
find_executable
(
'tar'
),
@
unittest
.
skipUnless
(
shutil
.
which
(
'tar'
),
'Need the tar command to run'
)
'Need the tar command to run'
)
def
test_tarfile_vs_tar
(
self
):
def
test_tarfile_vs_tar
(
self
):
root_dir
,
base_dir
=
self
.
_create_files
()
root_dir
,
base_dir
=
self
.
_create_files
()
...
@@ -1031,8 +1029,8 @@ class TestShutil(unittest.TestCase):
...
@@ -1031,8 +1029,8 @@ class TestShutil(unittest.TestCase):
# now create another tarball using `tar`
# now create another tarball using `tar`
tarball2
=
os
.
path
.
join
(
root_dir
,
'archive2.tar'
)
tarball2
=
os
.
path
.
join
(
root_dir
,
'archive2.tar'
)
tar_cmd
=
[
'tar'
,
'-cf'
,
'archive2.tar'
,
base_dir
]
tar_cmd
=
[
'tar'
,
'-cf'
,
'archive2.tar'
,
base_dir
]
with
support
.
change_cwd
(
root_dir
):
subprocess
.
check_call
(
tar_cmd
,
cwd
=
root_dir
,
spawn
(
tar_cmd
)
stdout
=
subprocess
.
DEVNULL
)
self
.
assertTrue
(
os
.
path
.
isfile
(
tarball2
))
self
.
assertTrue
(
os
.
path
.
isfile
(
tarball2
))
# let's compare both tarballs
# let's compare both tarballs
...
@@ -1076,7 +1074,7 @@ class TestShutil(unittest.TestCase):
...
@@ -1076,7 +1074,7 @@ class TestShutil(unittest.TestCase):
@
requires_zlib
@
requires_zlib
@
unittest
.
skipUnless
(
ZIP_SUPPORT
,
'Need zip support to run'
)
@
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'
)
'Need the zip command to run'
)
def
test_zipfile_vs_zip
(
self
):
def
test_zipfile_vs_zip
(
self
):
root_dir
,
base_dir
=
self
.
_create_files
()
root_dir
,
base_dir
=
self
.
_create_files
()
...
@@ -1090,8 +1088,8 @@ class TestShutil(unittest.TestCase):
...
@@ -1090,8 +1088,8 @@ class TestShutil(unittest.TestCase):
# now create another ZIP file using `zip`
# now create another ZIP file using `zip`
archive2
=
os
.
path
.
join
(
root_dir
,
'archive2.zip'
)
archive2
=
os
.
path
.
join
(
root_dir
,
'archive2.zip'
)
zip_cmd
=
[
'zip'
,
'-q'
,
'-r'
,
'archive2.zip'
,
base_dir
]
zip_cmd
=
[
'zip'
,
'-q'
,
'-r'
,
'archive2.zip'
,
base_dir
]
with
support
.
change_cwd
(
root_dir
):
subprocess
.
check_call
(
zip_cmd
,
cwd
=
root_dir
,
spawn
(
zip_cmd
)
stdout
=
subprocess
.
DEVNULL
)
self
.
assertTrue
(
os
.
path
.
isfile
(
archive2
))
self
.
assertTrue
(
os
.
path
.
isfile
(
archive2
))
# let's compare both ZIP files
# let's compare both ZIP files
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment