Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
a7931d03
Commit
a7931d03
authored
Aug 19, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite test, dynamically generating the .tar.gz file, with help from dstufft in #748.
parent
8aae14c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
32 deletions
+18
-32
setuptools/tests/test_archive_util.py
setuptools/tests/test_archive_util.py
+18
-32
No files found.
setuptools/tests/test_archive_util.py
View file @
a7931d03
# coding: utf-8
# coding: utf-8
import
tarfile
import
io
from
setuptools.extern
import
six
from
setuptools.extern
import
six
import
pytest
import
pytest
...
@@ -12,41 +15,24 @@ def tarfile_with_unicode(tmpdir):
...
@@ -12,41 +15,24 @@ def tarfile_with_unicode(tmpdir):
"""
"""
Create a tarfile containing only a file whose name is
Create a tarfile containing only a file whose name is
a zero byte file called testimäge.png.
a zero byte file called testimäge.png.
TODO: Is it possible to generate this file programmatically?
"""
"""
data
=
(
tarobj
=
io
.
BytesIO
()
b'
\
x1f
\
x8b
\
x08
\
x00
R
\
xfe
\
x9f
W
\
x00
\
x03
\
xed
\
xd6
AO
\
x13
A
\
x14
\
x00
'
b'
\
xe0
\
x11
b
\
x8c
\
x8d
\
'
z
\
xf0
2
\
x07
=x
\
xd9
\
xce
\
xcc
\
xce
\
xec
\
xd4
\
xc3
'
with
tarfile
.
open
(
fileobj
=
tarobj
,
mode
=
"w:gz"
)
as
tgz
:
b'&
\
xa2
1
\
xb4
X
\
\
lI
\
xa3
r0
\
xc3
v
\
xc1
\
x8a
\
xec
6
\
xcb
bz3
\
x1c
H
\
x80
x
\
x93
'
data
=
b""
b'x
\
xea
Q
\
x12
\
x13
\
x0f
$z
\
xd5
\
x13
\
x17
\
xa9
U
\
x8e
&
\
xfc
\
x06
\
x13
\
xff
'
b'
\
x82
\
xb3
\
xa5
\
n
\
xb6
J!
\
x16
\
x8c
\
xf0
\
xbe
d2
\
x9d
\
xd7
\
xe9
v
\
xba
\
xb3
'
filename
=
"testimäge.png"
b'
\
xaf
o
\
x8c
\
xe4
\
xa8
\
xaa
\
xa4
=U
\
xf4
\
xc2
\
xa4
\
xf1
\
xf2
f
\
xa3
\
xd2
\
xcc
'
if
six
.
PY2
:
b'
\
xfa
\
xcb
)
\
xcf
(
\
xfb
S
\
xa8
K
\
x08
!
\
x16
\
xe7
8
\
xee
\
xa5
%
\
x1a
=a
\
xdb
'
filename
=
filename
.
decode
(
'utf-8'
)
b'
\
xe3
\
x06
FLL
\
x99
\
xe4
R#
\
x9c
bB%
\
xa5
\
x1c
\
xe1
J
\
xb7
\
x16
\
xb0
\
x97
'
b'
\
xb9
\
xd9
H
\
x85
z)
\
x8f
T
\
xa8
\
xdc
\
xe0
\
xcf
\
xf3
\
xf4
\
xb4
\
xc9
\
xc9
=
\
xae
'
t
=
tarfile
.
TarInfo
(
filename
)
b'
\
xb3
\
xfd
S
\
xf0
\
xcf
\
xfe
?
\
xc1
$.
\
xab
\
xe8
\
xa1
m
\
xb4
\
xed
~
\
x82
\
x11
'
t
.
size
=
len
(
data
)
b'
\
xec
\
xea
\
xb1
gS.
\
t
%&e,
\
x8e
\
xa9
\
xdd
1"S
\
t
f
\
xe2
\
xfc
\
x8d
t&{
\
xcf
(zO'
b'lj
\
xe9
]d
\
x8c
\
xec
\
n
\
x97
\
xfc
\
xc0
\
xe6
\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b
\
x89
4
\
x7f
[
\
xfb
\
xcd
\
x14
\
xce
f
\
xae
\
x0f
\
xe6
tE/
\
xdc
4
\
xdc
\
xd0
'
b'
\
xd3
3
\
x02
\
xbf
9
\
xcb
Jq}f
\
xe0
t
\
xdf
\
'
\
x04
~
\
x95
\
xeb
0
\
x9c
\
x10
\
x8e
'
b'
\
xd0
a
\
xd7
\
xfe
X
\
xa7
\
xfc
\
x8f
\
xf3
\
xe5
\
xd7
\
xfc
\
xe7
\
xc2
\
xe2
P
\
xff
'
b'
\
x01
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
'
b'
\
x00
8
\
xa8
\
xef
\
xb1
g
\
xe1
Z
\
x00
(
\
x00
\
x00
'
)
target
=
tmpdir
/
'unicode-pkg-1.0.tar.gz'
target
=
tmpdir
/
'unicode-pkg-1.0.tar.gz'
with
open
(
str
(
target
),
mode
=
'wb'
)
as
tf
:
with
open
(
str
(
target
),
mode
=
'wb'
)
as
tf
:
tf
.
write
(
data
)
tf
.
write
(
tarobj
.
getvalue
()
)
return
str
(
target
)
return
str
(
target
)
...
...
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