Commit 8e0ac920 authored by Jason R. Coombs's avatar Jason R. Coombs

Expect failure running Python 3 only tests on Python 2

parent adcf0265
...@@ -20,6 +20,7 @@ c_type = os.environ.get("LC_CTYPE", os.environ.get("LC_ALL")) ...@@ -20,6 +20,7 @@ c_type = os.environ.get("LC_CTYPE", os.environ.get("LC_ALL"))
is_ascii = c_type in ("C", "POSIX") is_ascii = c_type in ("C", "POSIX")
fail_on_ascii = pytest.mark.xfail(is_ascii, reason="Test fails in this locale") fail_on_ascii = pytest.mark.xfail(is_ascii, reason="Test fails in this locale")
def makeSetup(**args): def makeSetup(**args):
"""Return distribution from 'setup(**args)', without executing commands""" """Return distribution from 'setup(**args)', without executing commands"""
......
...@@ -8,6 +8,8 @@ import tempfile ...@@ -8,6 +8,8 @@ import tempfile
import unicodedata import unicodedata
import contextlib import contextlib
import pytest
import pkg_resources import pkg_resources
from setuptools.compat import StringIO, unicode, PY3, PY2 from setuptools.compat import StringIO, unicode, PY3, PY2
from setuptools.command.sdist import sdist from setuptools.command.sdist import sdist
...@@ -16,6 +18,9 @@ from setuptools.dist import Distribution ...@@ -16,6 +18,9 @@ from setuptools.dist import Distribution
from setuptools.tests import fail_on_ascii from setuptools.tests import fail_on_ascii
py3_only = pytest.mark.xfail(PY2, reason="Test runs on Python 3 only")
SETUP_ATTRS = { SETUP_ATTRS = {
'name': 'sdist_test', 'name': 'sdist_test',
'version': '0.0', 'version': '0.0',
...@@ -181,9 +186,7 @@ class TestSdistTest: ...@@ -181,9 +186,7 @@ class TestSdistTest:
assert posix(filename) in u_contents assert posix(filename) in u_contents
# Python 3 only @py3_only
if PY3:
def test_write_manifest_allows_utf8_filenames(self): def test_write_manifest_allows_utf8_filenames(self):
# Test for #303. # Test for #303.
dist = Distribution(SETUP_ATTRS) dist = Distribution(SETUP_ATTRS)
...@@ -219,6 +222,7 @@ class TestSdistTest: ...@@ -219,6 +222,7 @@ class TestSdistTest:
# The filelist should have been updated as well # The filelist should have been updated as well
assert u_filename in mm.filelist.files assert u_filename in mm.filelist.files
@py3_only
def test_write_manifest_skips_non_utf8_filenames(self): def test_write_manifest_skips_non_utf8_filenames(self):
""" """
Files that cannot be encoded to UTF-8 (specifically, those that Files that cannot be encoded to UTF-8 (specifically, those that
...@@ -288,9 +292,7 @@ class TestSdistTest: ...@@ -288,9 +292,7 @@ class TestSdistTest:
filename = filename.decode('utf-8') filename = filename.decode('utf-8')
assert filename in cmd.filelist.files assert filename in cmd.filelist.files
# Python 3 only @py3_only
if PY3:
def test_read_manifest_skips_non_utf8_filenames(self): def test_read_manifest_skips_non_utf8_filenames(self):
# Test for #303. # Test for #303.
dist = Distribution(SETUP_ATTRS) dist = Distribution(SETUP_ATTRS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment