aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_easy_install.py
diff options
context:
space:
mode:
authorDaniele Esposti <daniele.esposti@gmail.com>2018-07-11 08:53:13 +0100
committerPaul Ganssle <paul@ganssle.io>2018-08-17 09:31:56 -0400
commit961387fb4112d631e4ddc1f48467205bc77d7fe6 (patch)
treef9aaaeb3aaed58615d7e96d45b95861fbf0f12d6 /setuptools/tests/test_easy_install.py
parent8d887526f34f8955d7df257a24e8e8cf9f3f16de (diff)
downloadexternal_python_setuptools-961387fb4112d631e4ddc1f48467205bc77d7fe6.tar.gz
external_python_setuptools-961387fb4112d631e4ddc1f48467205bc77d7fe6.tar.bz2
external_python_setuptools-961387fb4112d631e4ddc1f48467205bc77d7fe6.zip
Added test for scripts with unicode
Diffstat (limited to 'setuptools/tests/test_easy_install.py')
-rw-r--r--setuptools/tests/test_easy_install.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 345d283c..80a65497 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -186,6 +186,58 @@ class TestEasyInstallTest:
cmd.easy_install(sdist_unicode)
@pytest.fixture
+ def sdist_unicode_in_script(self, tmpdir):
+ files = [
+ (
+ "setup.py",
+ DALS("""
+ import setuptools
+ setuptools.setup(
+ name="setuptools-test-unicode",
+ version="1.0",
+ packages=["mypkg"],
+ include_package_data=True,
+ scripts=['mypkg/unicode_in_script'],
+ )
+ """),
+ ),
+ ("mypkg/__init__.py", ""),
+ (
+ "mypkg/unicode_in_script",
+ DALS(
+ """
+ #!/bin/sh
+ # \xc3\xa1
+
+ non_python_fn() {
+ }
+ """),
+ ),
+ ]
+ sdist_name = "setuptools-test-unicode-script-1.0.zip"
+ sdist = tmpdir / sdist_name
+ # 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)
+
+ @fail_on_ascii
+ def test_unicode_content_in_sdist(self, sdist_unicode_in_script, tmpdir, monkeypatch):
+ """
+ The install command should execute correctly even if
+ the package has unicode in scripts.
+ """
+ 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_in_script)
+
+ @pytest.fixture
def sdist_script(self, tmpdir):
files = [
(