aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_easy_install.py
diff options
context:
space:
mode:
authorErik Bray <embray@stsci.edu>2015-12-24 15:45:14 -0500
committerErik Bray <embray@stsci.edu>2015-12-24 15:45:14 -0500
commit2f2011b3d9e21861f003181ab0c3abb9701df83b (patch)
tree8d3a364dd61e0979edf02a5e418b43ee80704ad1 /setuptools/tests/test_easy_install.py
parent3f4ef89512da6a3e89f27121446ec59773869017 (diff)
downloadexternal_python_setuptools-2f2011b3d9e21861f003181ab0c3abb9701df83b.tar.gz
external_python_setuptools-2f2011b3d9e21861f003181ab0c3abb9701df83b.tar.bz2
external_python_setuptools-2f2011b3d9e21861f003181ab0c3abb9701df83b.zip
Fix failing test on Windows due to path formatting bugs
Diffstat (limited to 'setuptools/tests/test_easy_install.py')
-rw-r--r--setuptools/tests/test_easy_install.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 00e16b63..f0330f17 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -446,10 +446,15 @@ class TestScriptHeader:
exe = tmpdir / 'exe.py'
with exe.open('w') as f:
f.write(header)
- exe = str(exe)
+
+ exe = ei.nt_quote_arg(os.path.normpath(str(exe)))
+
+ # Make sure Windows paths are quoted properly before they're sent
+ # through shlex.split by get_script_header
+ executable = '"%s"' % exe if os.path.splitdrive(exe)[0] else exe
header = ei.ScriptWriter.get_script_header('#!/usr/local/bin/python',
- executable=exe)
+ executable=executable)
assert header == '#!/usr/bin/env %s\n' % exe
expect_out = 'stdout' if sys.version_info < (2,7) else 'stderr'
@@ -458,7 +463,7 @@ class TestScriptHeader:
# When options are included, generate a broken shebang line
# with a warning emitted
candidate = ei.ScriptWriter.get_script_header('#!/usr/bin/python -x',
- executable=exe)
+ executable=executable)
assert candidate == '#!%s -x\n' % exe
output = locals()[expect_out]
assert 'Unable to adapt shebang line' in output.getvalue()