aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-05-17 12:25:31 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-05-17 12:25:31 -0400
commit8567ca65adbf927a0af5c9b7314688dfbc46ab66 (patch)
tree345ee8e9d0eaa61a64786215cf6bda53abd5b5e5 /setuptools/tests
parent3c85da71f22c43041e7475b01b4683f22fc3a618 (diff)
downloadexternal_python_setuptools-8567ca65adbf927a0af5c9b7314688dfbc46ab66.tar.gz
external_python_setuptools-8567ca65adbf927a0af5c9b7314688dfbc46ab66.tar.bz2
external_python_setuptools-8567ca65adbf927a0af5c9b7314688dfbc46ab66.zip
Use PY3 and PY2 throughout
Diffstat (limited to 'setuptools/tests')
-rw-r--r--setuptools/tests/test_resources.py5
-rw-r--r--setuptools/tests/test_sdist.py24
-rw-r--r--setuptools/tests/test_test.py4
3 files changed, 16 insertions, 17 deletions
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index c9fcf76c..443905cc 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -15,7 +15,7 @@ from pkg_resources import (parse_requirements, VersionConflict, parse_version,
from setuptools.command.easy_install import (get_script_header, is_sh,
nt_quote_arg)
-from setuptools.compat import StringIO, iteritems
+from setuptools.compat import StringIO, iteritems, PY3
try:
frozenset
@@ -522,8 +522,7 @@ class ScriptHeaderTests(TestCase):
def test_get_script_header_jython_workaround(self):
# This test doesn't work with Python 3 in some locales
- if (sys.version_info >= (3,) and os.environ.get("LC_CTYPE")
- in (None, "C", "POSIX")):
+ if PY3 and os.environ.get("LC_CTYPE") in (None, "C", "POSIX"):
return
class java:
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index ada86189..231b40d0 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -12,7 +12,7 @@ import re
from setuptools.tests import environment, test_svn
from setuptools.tests.py26compat import skipIf
-from setuptools.compat import StringIO, unicode
+from setuptools.compat import StringIO, unicode, PY3, PY2
from setuptools.tests.py26compat import skipIf
from setuptools.command.sdist import sdist, walk_revctrl
from setuptools.command.egg_info import manifest_maker
@@ -34,7 +34,7 @@ setup(**%r)
""" % SETUP_ATTRS
-if sys.version_info >= (3,):
+if PY3:
LATIN1_FILENAME = 'smörbröd.py'.encode('latin-1')
else:
LATIN1_FILENAME = 'sm\xf6rbr\xf6d.py'
@@ -52,14 +52,14 @@ def unquiet():
# Fake byte literals for Python <= 2.5
def b(s, encoding='utf-8'):
- if sys.version_info >= (3,):
+ if PY3:
return s.encode(encoding)
return s
# Convert to POSIX path
def posix(path):
- if sys.version_info >= (3,) and not isinstance(path, str):
+ if PY3 and not isinstance(path, str):
return path.replace(os.sep.encode('ascii'), b('/'))
else:
return path.replace(os.sep, '/')
@@ -156,14 +156,14 @@ class TestSdistTest(unittest.TestCase):
self.fail(e)
# The manifest should contain the UTF-8 filename
- if sys.version_info < (3,):
+ if PY2:
fs_enc = sys.getfilesystemencoding()
filename = filename.decode(fs_enc)
self.assertTrue(posix(filename) in u_contents)
# Python 3 only
- if sys.version_info >= (3,):
+ if PY3:
def test_write_manifest_allows_utf8_filenames(self):
# Test for #303.
@@ -281,12 +281,12 @@ class TestSdistTest(unittest.TestCase):
unquiet()
# The filelist should contain the UTF-8 filename
- if sys.version_info >= (3,):
+ if PY3:
filename = filename.decode('utf-8')
self.assertTrue(filename in cmd.filelist.files)
# Python 3 only
- if sys.version_info >= (3,):
+ if PY3:
def test_read_manifest_skips_non_utf8_filenames(self):
# Test for #303.
@@ -328,7 +328,7 @@ class TestSdistTest(unittest.TestCase):
filename = filename.decode('latin-1')
self.assertFalse(filename in cmd.filelist.files)
- @skipIf(sys.version_info >= (3,) and locale.getpreferredencoding() != 'UTF-8',
+ @skipIf(PY3 and locale.getpreferredencoding() != 'UTF-8',
'Unittest fails if locale is not utf-8 but the manifests is recorded correctly')
def test_sdist_with_utf8_encoded_filename(self):
# Test for #303.
@@ -350,7 +350,7 @@ class TestSdistTest(unittest.TestCase):
if sys.platform == 'darwin':
filename = decompose(filename)
- if sys.version_info >= (3,):
+ if PY3:
fs_enc = sys.getfilesystemencoding()
if sys.platform == 'win32':
@@ -385,7 +385,7 @@ class TestSdistTest(unittest.TestCase):
finally:
unquiet()
- if sys.version_info >= (3,):
+ if PY3:
#not all windows systems have a default FS encoding of cp1252
if sys.platform == 'win32':
# Latin-1 is similar to Windows-1252 however
@@ -408,7 +408,7 @@ class TestSdistTest(unittest.TestCase):
try:
# fs_enc should match how one is expect the decoding to
# be proformed for the manifest output.
- fs_enc = sys.getfilesystemencoding()
+ fs_enc = sys.getfilesystemencoding()
filename.decode(fs_enc)
self.assertTrue(filename in cmd.filelist.files)
except UnicodeDecodeError:
diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py
index f85123b0..df92085e 100644
--- a/setuptools/tests/test_test.py
+++ b/setuptools/tests/test_test.py
@@ -10,7 +10,7 @@ import tempfile
import unittest
from distutils.errors import DistutilsError
-from setuptools.compat import StringIO
+from setuptools.compat import StringIO, PY2
from setuptools.command.test import test
from setuptools.command import easy_install as easy_install_pkg
from setuptools.dist import Distribution
@@ -34,7 +34,7 @@ except ImportError:
__path__ = extend_path(__path__, __name__)
"""
# Make sure this is Latin-1 binary, before writing:
-if sys.version_info < (3,):
+if PY2:
NS_INIT = NS_INIT.decode('UTF-8')
NS_INIT = NS_INIT.encode('Latin-1')