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
25720176
Commit
25720176
authored
Sep 07, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explicitly test archive name in shutil.make_archive() tests to expose failure
details in issue25018.
parent
2764002b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
Lib/test/test_shutil.py
Lib/test/test_shutil.py
+11
-11
No files found.
Lib/test/test_shutil.py
View file @
25720176
...
...
@@ -974,10 +974,10 @@ class TestShutil(unittest.TestCase):
base_name
=
os
.
path
.
join
(
tmpdir2
,
'archive'
)
# working with relative paths to avoid tar warnings
make_archive
(
splitdrive
(
base_name
)[
1
],
'gztar'
,
root_dir
,
'.'
)
tarball
=
make_archive
(
splitdrive
(
base_name
)[
1
],
'gztar'
,
root_dir
,
'.'
)
# check if the compressed tarball was created
tarball
=
base_name
+
'.tar.gz'
self
.
assertEqual
(
tarball
,
base_name
+
'.tar.gz'
)
self
.
assertTrue
(
os
.
path
.
isfile
(
tarball
))
self
.
assertTrue
(
tarfile
.
is_tarfile
(
tarball
))
with
tarfile
.
open
(
tarball
,
'r:gz'
)
as
tf
:
...
...
@@ -986,9 +986,8 @@ class TestShutil(unittest.TestCase):
'./file1'
,
'./file2'
,
'./sub/file3'
])
# trying an uncompressed one
base_name
=
os
.
path
.
join
(
tmpdir2
,
'archive'
)
make_archive
(
splitdrive
(
base_name
)[
1
],
'tar'
,
root_dir
,
'.'
)
tarball
=
base_name
+
'.tar'
tarball
=
make_archive
(
splitdrive
(
base_name
)[
1
],
'tar'
,
root_dir
,
'.'
)
self
.
assertEqual
(
tarball
,
base_name
+
'.tar'
)
self
.
assertTrue
(
os
.
path
.
isfile
(
tarball
))
self
.
assertTrue
(
tarfile
.
is_tarfile
(
tarball
))
with
tarfile
.
open
(
tarball
,
'r'
)
as
tf
:
...
...
@@ -1022,10 +1021,10 @@ class TestShutil(unittest.TestCase):
def
test_tarfile_vs_tar
(
self
):
root_dir
,
base_dir
=
self
.
_create_files
()
base_name
=
os
.
path
.
join
(
self
.
mkdtemp
(),
'archive'
)
make_archive
(
base_name
,
'gztar'
,
root_dir
,
base_dir
)
tarball
=
make_archive
(
base_name
,
'gztar'
,
root_dir
,
base_dir
)
# check if the compressed tarball was created
tarball
=
base_name
+
'.tar.gz'
self
.
assertEqual
(
tarball
,
base_name
+
'.tar.gz'
)
self
.
assertTrue
(
os
.
path
.
isfile
(
tarball
))
# now create another tarball using `tar`
...
...
@@ -1039,13 +1038,14 @@ class TestShutil(unittest.TestCase):
self
.
assertEqual
(
self
.
_tarinfo
(
tarball
),
self
.
_tarinfo
(
tarball2
))
# trying an uncompressed one
make_archive
(
base_name
,
'tar'
,
root_dir
,
base_dir
)
tarball
=
base_name
+
'.tar'
tarball
=
make_archive
(
base_name
,
'tar'
,
root_dir
,
base_dir
)
self
.
assertEqual
(
tarball
,
base_name
+
'.tar'
)
self
.
assertTrue
(
os
.
path
.
isfile
(
tarball
))
# now for a dry_run
make_archive
(
base_name
,
'tar'
,
root_dir
,
base_dir
,
dry_run
=
True
)
tarball
=
base_name
+
'.tar'
tarball
=
make_archive
(
base_name
,
'tar'
,
root_dir
,
base_dir
,
dry_run
=
True
)
self
.
assertEqual
(
tarball
,
base_name
+
'.tar'
)
self
.
assertTrue
(
os
.
path
.
isfile
(
tarball
))
@
requires_zlib
...
...
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