summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-01-01 12:08:46 -0500
committerJason R. Coombs <jaraco@jaraco.com>2020-01-01 18:16:35 -0500
commit3d5b7775b7b7ee6c0b354a04fe1d33c1f9b0e5df (patch)
tree44e13d7d34926e0c884dae5472f58620e8656c33
parent90922a5eb9b2f002202a16c974b86750a46d21ea (diff)
downloadpython-setuptools-git-3d5b7775b7b7ee6c0b354a04fe1d33c1f9b0e5df.tar.gz
Fix latin1 and utf8 tests on Python 2
-rw-r--r--setuptools/tests/test_sdist.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index 9ddbae8b..8538dd24 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -369,7 +369,7 @@ class TestSdistTest:
@fail_on_latin1_encoded_filenames
def test_sdist_with_utf8_encoded_filename(self):
# Test for #303.
- dist = Distribution(SETUP_ATTRS)
+ dist = Distribution(self.make_strings(SETUP_ATTRS))
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
@@ -400,10 +400,19 @@ class TestSdistTest:
else:
assert filename in cmd.filelist.files
+ @classmethod
+ def make_strings(cls, item):
+ if isinstance(item, dict):
+ return {
+ key: cls.make_strings(value) for key, value in item.items()}
+ if isinstance(item, list):
+ return list(map(cls.make_strings, item))
+ return str(item)
+
@fail_on_latin1_encoded_filenames
def test_sdist_with_latin1_encoded_filename(self):
# Test for #303.
- dist = Distribution(SETUP_ATTRS)
+ dist = Distribution(self.make_strings(SETUP_ATTRS))
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()