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
b8936cee
Commit
b8936cee
authored
Oct 11, 2017
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use natural byte literals in test_sdist
parent
c292a995
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
setuptools/tests/test_sdist.py
setuptools/tests/test_sdist.py
+11
-17
No files found.
setuptools/tests/test_sdist.py
View file @
b8936cee
...
@@ -41,6 +41,8 @@ if six.PY3:
...
@@ -41,6 +41,8 @@ if six.PY3:
else
:
else
:
LATIN1_FILENAME
=
'sm
\
xf6
rbr
\
xf6
d.py'
LATIN1_FILENAME
=
'sm
\
xf6
rbr
\
xf6
d.py'
utf_8_filename
=
LATIN1_FILENAME
.
decode
(
'latin-1'
).
encode
(
'utf-8'
)
@
contextlib
.
contextmanager
@
contextlib
.
contextmanager
def
quiet
():
def
quiet
():
...
@@ -52,17 +54,10 @@ def quiet():
...
@@ -52,17 +54,10 @@ def quiet():
sys
.
stdout
,
sys
.
stderr
=
old_stdout
,
old_stderr
sys
.
stdout
,
sys
.
stderr
=
old_stdout
,
old_stderr
# Fake byte literals for Python <= 2.5
def
b
(
s
,
encoding
=
'utf-8'
):
if
six
.
PY3
:
return
s
.
encode
(
encoding
)
return
s
# Convert to POSIX path
# Convert to POSIX path
def
posix
(
path
):
def
posix
(
path
):
if
six
.
PY3
and
not
isinstance
(
path
,
str
):
if
six
.
PY3
and
not
isinstance
(
path
,
str
):
return
path
.
replace
(
os
.
sep
.
encode
(
'ascii'
),
b
(
'/'
)
)
return
path
.
replace
(
os
.
sep
.
encode
(
'ascii'
),
b
'/'
)
else
:
else
:
return
path
.
replace
(
os
.
sep
,
'/'
)
return
path
.
replace
(
os
.
sep
,
'/'
)
...
@@ -200,8 +195,7 @@ class TestSdistTest:
...
@@ -200,8 +195,7 @@ class TestSdistTest:
mm
.
manifest
=
os
.
path
.
join
(
'sdist_test.egg-info'
,
'SOURCES.txt'
)
mm
.
manifest
=
os
.
path
.
join
(
'sdist_test.egg-info'
,
'SOURCES.txt'
)
os
.
mkdir
(
'sdist_test.egg-info'
)
os
.
mkdir
(
'sdist_test.egg-info'
)
# UTF-8 filename
filename
=
os
.
path
.
join
(
b'sdist_test'
,
utf_8_filename
)
filename
=
os
.
path
.
join
(
b
(
'sdist_test'
),
b
(
'smörbröd.py'
))
# Must touch the file or risk removal
# Must touch the file or risk removal
open
(
filename
,
"w"
).
close
()
open
(
filename
,
"w"
).
close
()
...
@@ -240,7 +234,7 @@ class TestSdistTest:
...
@@ -240,7 +234,7 @@ class TestSdistTest:
os
.
mkdir
(
'sdist_test.egg-info'
)
os
.
mkdir
(
'sdist_test.egg-info'
)
# Latin-1 filename
# Latin-1 filename
filename
=
os
.
path
.
join
(
b
(
'sdist_test'
)
,
LATIN1_FILENAME
)
filename
=
os
.
path
.
join
(
b
'sdist_test'
,
LATIN1_FILENAME
)
# Add filename with surrogates and write manifest
# Add filename with surrogates and write manifest
with
quiet
():
with
quiet
():
...
@@ -274,10 +268,10 @@ class TestSdistTest:
...
@@ -274,10 +268,10 @@ class TestSdistTest:
cmd
.
run
()
cmd
.
run
()
# Add UTF-8 filename to manifest
# Add UTF-8 filename to manifest
filename
=
os
.
path
.
join
(
b
(
'sdist_test'
),
b
(
'smörbröd.py'
)
)
filename
=
os
.
path
.
join
(
b
'sdist_test'
,
utf_8_filename
)
cmd
.
manifest
=
os
.
path
.
join
(
'sdist_test.egg-info'
,
'SOURCES.txt'
)
cmd
.
manifest
=
os
.
path
.
join
(
'sdist_test.egg-info'
,
'SOURCES.txt'
)
manifest
=
open
(
cmd
.
manifest
,
'ab'
)
manifest
=
open
(
cmd
.
manifest
,
'ab'
)
manifest
.
write
(
b
(
'
\
n
'
)
+
filename
)
manifest
.
write
(
b
'
\
n
'
+
filename
)
manifest
.
close
()
manifest
.
close
()
# The file must exist to be included in the filelist
# The file must exist to be included in the filelist
...
@@ -306,10 +300,10 @@ class TestSdistTest:
...
@@ -306,10 +300,10 @@ class TestSdistTest:
cmd
.
run
()
cmd
.
run
()
# Add Latin-1 filename to manifest
# Add Latin-1 filename to manifest
filename
=
os
.
path
.
join
(
b
(
'sdist_test'
)
,
LATIN1_FILENAME
)
filename
=
os
.
path
.
join
(
b
'sdist_test'
,
LATIN1_FILENAME
)
cmd
.
manifest
=
os
.
path
.
join
(
'sdist_test.egg-info'
,
'SOURCES.txt'
)
cmd
.
manifest
=
os
.
path
.
join
(
'sdist_test.egg-info'
,
'SOURCES.txt'
)
manifest
=
open
(
cmd
.
manifest
,
'ab'
)
manifest
=
open
(
cmd
.
manifest
,
'ab'
)
manifest
.
write
(
b
(
'
\
n
'
)
+
filename
)
manifest
.
write
(
b
'
\
n
'
+
filename
)
manifest
.
close
()
manifest
.
close
()
# The file must exist to be included in the filelist
# The file must exist to be included in the filelist
...
@@ -333,7 +327,7 @@ class TestSdistTest:
...
@@ -333,7 +327,7 @@ class TestSdistTest:
cmd
.
ensure_finalized
()
cmd
.
ensure_finalized
()
# UTF-8 filename
# UTF-8 filename
filename
=
os
.
path
.
join
(
b
(
'sdist_test'
),
b
(
'smörbröd.py'
)
)
filename
=
os
.
path
.
join
(
b
'sdist_test'
,
utf_8_filename
)
open
(
filename
,
'w'
).
close
()
open
(
filename
,
'w'
).
close
()
with
quiet
():
with
quiet
():
...
@@ -367,7 +361,7 @@ class TestSdistTest:
...
@@ -367,7 +361,7 @@ class TestSdistTest:
cmd
.
ensure_finalized
()
cmd
.
ensure_finalized
()
# Latin-1 filename
# Latin-1 filename
filename
=
os
.
path
.
join
(
b
(
'sdist_test'
)
,
LATIN1_FILENAME
)
filename
=
os
.
path
.
join
(
b
'sdist_test'
,
LATIN1_FILENAME
)
open
(
filename
,
'w'
).
close
()
open
(
filename
,
'w'
).
close
()
assert
os
.
path
.
isfile
(
filename
)
assert
os
.
path
.
isfile
(
filename
)
...
...
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