aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/tests')
-rw-r--r--setuptools/tests/__init__.py4
-rw-r--r--setuptools/tests/test_easy_install.py4
-rw-r--r--setuptools/tests/test_sdist.py8
3 files changed, 10 insertions, 6 deletions
diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py
index b8a29cba..a93be134 100644
--- a/setuptools/tests/__init__.py
+++ b/setuptools/tests/__init__.py
@@ -16,6 +16,10 @@ import setuptools.depends as dep
from setuptools import Feature
from setuptools.depends import Require
+c_type = os.environ.get("LC_CTYPE", os.environ.get("LC_ALL"))
+is_ascii = c_type in ("C", "POSIX")
+fail_on_ascii = pytest.mark.xfail(is_ascii, "Test fails in this locale")
+
def makeSetup(**args):
"""Return distribution from 'setup(**args)', without executing commands"""
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index fa510098..00e16b63 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -35,7 +35,7 @@ import setuptools.tests.server
import pkg_resources
from .py26compat import tarfile_open
-from . import contexts
+from . import contexts, is_ascii
from .textwrap import DALS
@@ -430,8 +430,6 @@ class TestScriptHeader:
expected = '#!"%s"\n' % self.exe_with_spaces
assert actual == expected
- c_type = os.environ.get("LC_CTYPE", os.environ.get("LC_ALL"))
- is_ascii = c_type in ("C", "POSIX")
@pytest.mark.xfail(
compat.PY3 and is_ascii,
reason="Test fails in this locale on Python 3"
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index 9013b505..4313c456 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -16,6 +16,8 @@ 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
+from setuptools.tests import fail_on_ascii
+
SETUP_ATTRS = {
'name': 'sdist_test',
@@ -147,6 +149,7 @@ class TestSdistTest:
assert 'setup.py' not in manifest, manifest
assert 'setup.cfg' not in manifest, manifest
+ @fail_on_ascii
def test_manifest_is_written_with_utf8_encoding(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
@@ -256,6 +259,7 @@ class TestSdistTest:
# The filelist should have been updated as well
assert u_filename not in mm.filelist.files
+ @fail_on_ascii
def test_manifest_is_read_with_utf8_encoding(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
@@ -320,9 +324,7 @@ class TestSdistTest:
filename = filename.decode('latin-1')
assert filename not in cmd.filelist.files
- @pytest.mark.skipif(PY3 and locale.getpreferredencoding() != 'UTF-8',
- reason='Unittest fails if locale is not utf-8 but the manifests is '
- 'recorded correctly')
+ @fail_on_ascii
def test_sdist_with_utf8_encoded_filename(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)