diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2016-07-30 10:42:13 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-07-30 10:42:13 -0400 |
| commit | 7317122ae9092ab72d1ae82bad1afc887fca6508 (patch) | |
| tree | e2635f825eda955901a2215618c02ee6c7a8e81d /setuptools | |
| parent | 1074affc4a94224f30692db4ab0d45ed29ac8c8d (diff) | |
| download | python-setuptools-git-7317122ae9092ab72d1ae82bad1afc887fca6508.tar.gz | |
Add test capturing undesirable behavior when unicode characters appear in the filename of a zip sdist. Ref #704.
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/tests/test_easy_install.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 11299c7c..b7429d49 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -135,6 +135,57 @@ class TestEasyInstallTest: monkeypatch.delattr(site, 'getsitepackages', raising=False) assert ei.get_site_dirs() + @pytest.fixture + def sdist_unicode(self, tmpdir): + files = [ + ( + 'setup.py', + DALS(""" + import setuptools + setuptools.setup( + name="setuptools-test-unicode", + version="1.0", + packages=["mypkg"], + include_package_data=True, + ) + """), + ), + ( + 'mypkg/__init__.py', + "", + ), + ( + u'mypkg/\u2603.txt', + "", + ), + ] + sdist_name = 'setuptools-test-unicode-1.0.zip' + sdist = tmpdir / sdist_name + import zipfile + # can't use make_sdist, because the issue only occurs + # with zip sdists. + sdist_zip = zipfile.ZipFile(str(sdist), 'w') + for filename, content in files: + sdist_zip.writestr(filename, content) + sdist_zip.close() + return str(sdist) + + def test_unicode_filename_in_sdist(self, sdist_unicode, tmpdir, monkeypatch): + """ + The install command should execute correctly even if + the package has unicode filenames. + """ + dist = Distribution({'script_args': ['easy_install']}) + target = (tmpdir / 'target').ensure_dir() + cmd = ei.easy_install( + dist, + install_dir=str(target), + args=['x'], + ) + monkeypatch.setitem(os.environ, 'PYTHONPATH', str(target)) + cmd.ensure_finalized() + cmd.easy_install(sdist_unicode) + class TestPTHFileWriter: |
