aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_sdist.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/tests/test_sdist.py')
-rw-r--r--setuptools/tests/test_sdist.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index 943a5dee..d30e21ac 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -9,10 +9,10 @@ import tempfile
import unicodedata
import contextlib
+import six
import pytest
import pkg_resources
-from setuptools.compat import StringIO, unicode, PY3, PY2
from setuptools.command.sdist import sdist
from setuptools.command.egg_info import manifest_maker
from setuptools.dist import Distribution
@@ -32,7 +32,7 @@ setup(**%r)
""" % SETUP_ATTRS
-if PY3:
+if six.PY3:
LATIN1_FILENAME = 'smörbröd.py'.encode('latin-1')
else:
LATIN1_FILENAME = 'sm\xf6rbr\xf6d.py'
@@ -42,7 +42,7 @@ else:
@contextlib.contextmanager
def quiet():
old_stdout, old_stderr = sys.stdout, sys.stderr
- sys.stdout, sys.stderr = StringIO(), StringIO()
+ sys.stdout, sys.stderr = six.StringIO(), six.StringIO()
try:
yield
finally:
@@ -51,14 +51,14 @@ def quiet():
# Fake byte literals for Python <= 2.5
def b(s, encoding='utf-8'):
- if PY3:
+ if six.PY3:
return s.encode(encoding)
return s
# Convert to POSIX path
def posix(path):
- if PY3 and not isinstance(path, str):
+ if six.PY3 and not isinstance(path, str):
return path.replace(os.sep.encode('ascii'), b('/'))
else:
return path.replace(os.sep, '/')
@@ -66,7 +66,7 @@ def posix(path):
# HFS Plus uses decomposed UTF-8
def decompose(path):
- if isinstance(path, unicode):
+ if isinstance(path, six.text_type):
return unicodedata.normalize('NFD', path)
try:
path = path.decode('utf-8')
@@ -179,14 +179,14 @@ class TestSdistTest:
self.fail(e)
# The manifest should contain the UTF-8 filename
- if PY2:
+ if six.PY2:
fs_enc = sys.getfilesystemencoding()
filename = filename.decode(fs_enc)
assert posix(filename) in u_contents
# Python 3 only
- if PY3:
+ if six.PY3:
def test_write_manifest_allows_utf8_filenames(self):
# Test for #303.
@@ -295,12 +295,12 @@ class TestSdistTest:
cmd.read_manifest()
# The filelist should contain the UTF-8 filename
- if PY3:
+ if six.PY3:
filename = filename.decode('utf-8')
assert filename in cmd.filelist.files
# Python 3 only
- if PY3:
+ if six.PY3:
def test_read_manifest_skips_non_utf8_filenames(self):
# Test for #303.
@@ -336,7 +336,7 @@ class TestSdistTest:
filename = filename.decode('latin-1')
assert filename not in cmd.filelist.files
- @pytest.mark.skipif(PY3 and locale.getpreferredencoding() != 'UTF-8',
+ @pytest.mark.skipif(six.PY3 and locale.getpreferredencoding() != 'UTF-8',
reason='Unittest fails if locale is not utf-8 but the manifests is '
'recorded correctly')
def test_sdist_with_utf8_encoded_filename(self):
@@ -356,7 +356,7 @@ class TestSdistTest:
if sys.platform == 'darwin':
filename = decompose(filename)
- if PY3:
+ if six.PY3:
fs_enc = sys.getfilesystemencoding()
if sys.platform == 'win32':
@@ -388,7 +388,7 @@ class TestSdistTest:
with quiet():
cmd.run()
- if PY3:
+ if six.PY3:
# not all windows systems have a default FS encoding of cp1252
if sys.platform == 'win32':
# Latin-1 is similar to Windows-1252 however