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
421489f8
Commit
421489f8
authored
Dec 30, 2012
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16645: Fix hardlink extracting test for tarfile.
parent
14e27d89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
Lib/test/test_tarfile.py
Lib/test/test_tarfile.py
+11
-16
No files found.
Lib/test/test_tarfile.py
View file @
421489f8
...
@@ -297,26 +297,21 @@ class MiscReadTest(CommonReadTest):
...
@@ -297,26 +297,21 @@ class MiscReadTest(CommonReadTest):
def
test_extract_hardlink
(
self
):
def
test_extract_hardlink
(
self
):
# Test hardlink extraction (e.g. bug #857297).
# Test hardlink extraction (e.g. bug #857297).
tar
=
tarfile
.
open
(
tarname
,
errorlevel
=
1
,
encoding
=
"iso8859-1"
)
with
tarfile
.
open
(
tarname
,
errorlevel
=
1
,
encoding
=
"iso8859-1"
)
as
tar
:
tar
.
extract
(
"ustar/regtype"
,
TEMPDIR
)
self
.
addCleanup
(
os
.
remove
,
os
.
path
.
join
(
TEMPDIR
,
"ustar/regtype"
))
tar
.
extract
(
"ustar/regtype"
,
TEMPDIR
)
try
:
tar
.
extract
(
"ustar/lnktype"
,
TEMPDIR
)
tar
.
extract
(
"ustar/lnktype"
,
TEMPDIR
)
except
EnvironmentError
,
e
:
self
.
addCleanup
(
os
.
remove
,
os
.
path
.
join
(
TEMPDIR
,
"ustar/lnktype"
))
if
e
.
errno
==
errno
.
ENOENT
:
with
open
(
os
.
path
.
join
(
TEMPDIR
,
"ustar/lnktype"
),
"rb"
)
as
f
:
self
.
fail
(
"hardlink not extracted properly"
)
data
=
f
.
read
()
self
.
assertEqual
(
md5sum
(
data
),
md5_regtype
)
data
=
open
(
os
.
path
.
join
(
TEMPDIR
,
"ustar/lnktype"
),
"rb"
).
read
()
self
.
assertEqual
(
md5sum
(
data
),
md5_regtype
)
try
:
tar
.
extract
(
"ustar/symtype"
,
TEMPDIR
)
tar
.
extract
(
"ustar/symtype"
,
TEMPDIR
)
except
EnvironmentError
,
e
:
self
.
addCleanup
(
os
.
remove
,
os
.
path
.
join
(
TEMPDIR
,
"ustar/symtype"
))
if
e
.
errno
==
errno
.
ENOENT
:
with
open
(
os
.
path
.
join
(
TEMPDIR
,
"ustar/symtype"
),
"rb"
)
as
f
:
self
.
fail
(
"symlink not extracted properly"
)
data
=
f
.
read
()
self
.
assertEqual
(
md5sum
(
data
),
md5_regtype
)
data
=
open
(
os
.
path
.
join
(
TEMPDIR
,
"ustar/symtype"
),
"rb"
).
read
()
self
.
assertEqual
(
md5sum
(
data
),
md5_regtype
)
def
test_extractall
(
self
):
def
test_extractall
(
self
):
# Test if extractall() correctly restores directory permissions
# Test if extractall() correctly restores directory permissions
...
...
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