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
ba46991d
Commit
ba46991d
authored
Oct 11, 2017
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move filename fixtures to a 'text' module so they can use unicode literals.
parent
a85c59d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
setuptools/tests/test_sdist.py
setuptools/tests/test_sdist.py
+8
-15
setuptools/tests/text.py
setuptools/tests/text.py
+9
-0
No files found.
setuptools/tests/test_sdist.py
View file @
ba46991d
...
...
@@ -19,6 +19,7 @@ from setuptools.command.sdist import sdist
from
setuptools.command.egg_info
import
manifest_maker
from
setuptools.dist
import
Distribution
from
setuptools.tests
import
fail_on_ascii
from
.text
import
Filenames
py3_only
=
pytest
.
mark
.
xfail
(
six
.
PY2
,
reason
=
"Test runs on Python 3 only"
)
...
...
@@ -36,13 +37,6 @@ from setuptools import setup
setup(**%r)
"""
%
SETUP_ATTRS
if
six
.
PY3
:
LATIN1_FILENAME
=
'smörbröd.py'
.
encode
(
'latin-1'
)
else
:
LATIN1_FILENAME
=
'sm
\
xf6
rbr
\
xf6
d.py'
utf_8_filename
=
LATIN1_FILENAME
.
decode
(
'latin-1'
).
encode
(
'utf-8'
)
@
contextlib
.
contextmanager
def
quiet
():
...
...
@@ -82,7 +76,7 @@ def read_all_bytes(filename):
def
latin1_fail
():
try
:
desc
,
filename
=
tempfile
.
mkstemp
(
suffix
=
LATIN1_FILENAME
)
desc
,
filename
=
tempfile
.
mkstemp
(
suffix
=
Filenames
.
latin_1
)
os
.
close
(
desc
)
os
.
remove
(
filename
)
except
Exception
:
...
...
@@ -212,7 +206,7 @@ class TestSdistTest:
mm
.
manifest
=
os
.
path
.
join
(
'sdist_test.egg-info'
,
'SOURCES.txt'
)
os
.
mkdir
(
'sdist_test.egg-info'
)
filename
=
os
.
path
.
join
(
b'sdist_test'
,
utf_8_filename
)
filename
=
os
.
path
.
join
(
b'sdist_test'
,
Filenames
.
utf_8
)
# Must touch the file or risk removal
open
(
filename
,
"w"
).
close
()
...
...
@@ -251,7 +245,7 @@ class TestSdistTest:
os
.
mkdir
(
'sdist_test.egg-info'
)
# Latin-1 filename
filename
=
os
.
path
.
join
(
b'sdist_test'
,
LATIN1_FILENAME
)
filename
=
os
.
path
.
join
(
b'sdist_test'
,
Filenames
.
latin_1
)
# Add filename with surrogates and write manifest
with
quiet
():
...
...
@@ -285,7 +279,7 @@ class TestSdistTest:
cmd
.
run
()
# Add UTF-8 filename to manifest
filename
=
os
.
path
.
join
(
b'sdist_test'
,
utf_8_filename
)
filename
=
os
.
path
.
join
(
b'sdist_test'
,
Filenames
.
utf_8
)
cmd
.
manifest
=
os
.
path
.
join
(
'sdist_test.egg-info'
,
'SOURCES.txt'
)
manifest
=
open
(
cmd
.
manifest
,
'ab'
)
manifest
.
write
(
b'
\
n
'
+
filename
)
...
...
@@ -318,7 +312,7 @@ class TestSdistTest:
cmd
.
run
()
# Add Latin-1 filename to manifest
filename
=
os
.
path
.
join
(
b'sdist_test'
,
LATIN1_FILENAME
)
filename
=
os
.
path
.
join
(
b'sdist_test'
,
Filenames
.
latin_1
)
cmd
.
manifest
=
os
.
path
.
join
(
'sdist_test.egg-info'
,
'SOURCES.txt'
)
manifest
=
open
(
cmd
.
manifest
,
'ab'
)
manifest
.
write
(
b'
\
n
'
+
filename
)
...
...
@@ -345,8 +339,7 @@ class TestSdistTest:
cmd
=
sdist
(
dist
)
cmd
.
ensure_finalized
()
# UTF-8 filename
filename
=
os
.
path
.
join
(
b'sdist_test'
,
utf_8_filename
)
filename
=
os
.
path
.
join
(
b'sdist_test'
,
Filenames
.
utf_8
)
open
(
filename
,
'w'
).
close
()
with
quiet
():
...
...
@@ -381,7 +374,7 @@ class TestSdistTest:
cmd
.
ensure_finalized
()
# Latin-1 filename
filename
=
os
.
path
.
join
(
b'sdist_test'
,
LATIN1_FILENAME
)
filename
=
os
.
path
.
join
(
b'sdist_test'
,
Filenames
.
latin_1
)
open
(
filename
,
'w'
).
close
()
assert
os
.
path
.
isfile
(
filename
)
...
...
setuptools/tests/text.py
0 → 100644
View file @
ba46991d
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
class
Filenames
:
unicode
=
'smörbröd.py'
latin_1
=
unicode
.
encode
(
'latin-1'
)
utf_8
=
unicode
.
encode
(
'utf-8'
)
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