diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-03 03:35:38 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-03 03:35:38 -0500 |
commit | 29f9540d973d5e2f5dbc5dd631287b6f059c8630 (patch) | |
tree | 7bcbaf6dff38c5983cd90f2c2180b315b109ae9a /setuptools/tests/test_easy_install.py | |
parent | 63c14c76f8976864b90263da26eaa09f531e61b8 (diff) | |
download | external_python_setuptools-29f9540d973d5e2f5dbc5dd631287b6f059c8630.tar.gz external_python_setuptools-29f9540d973d5e2f5dbc5dd631287b6f059c8630.tar.bz2 external_python_setuptools-29f9540d973d5e2f5dbc5dd631287b6f059c8630.zip |
Remove dependence of the script on its own file, but instead generate the necessary file in a temporary directory.
Diffstat (limited to 'setuptools/tests/test_easy_install.py')
-rw-r--r-- | setuptools/tests/test_easy_install.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index f93dbd4c..cfc4d6bf 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -1,6 +1,4 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# NOTE: the shebang and encoding lines are for TestScriptHeader do not remove +#! -*- coding: utf-8 -*- """Easy install Tests """ @@ -450,9 +448,17 @@ class TestScriptHeader: @mock.patch.dict(sys.modules, java=mock.Mock(lang=mock.Mock(System= mock.Mock(getProperty=mock.Mock(return_value=""))))) @mock.patch('sys.platform', 'java1.5.0_13') - def test_get_script_header_jython_workaround(self): - # A mock sys.executable that uses a shebang line (this file) - exe = os.path.normpath(os.path.splitext(__file__)[0] + '.py') + def test_get_script_header_jython_workaround(self, tmpdir): + # Create a mock sys.executable that uses a shebang line + header = DALS(""" + #!/usr/bin/python + # -*- coding: utf-8 -*- + """) + exe = tmpdir / 'exe.py' + with exe.open('w') as f: + f.write(header) + exe = str(exe) + header = get_script_header('#!/usr/local/bin/python', executable=exe) assert header == '#!/usr/bin/env %s\n' % exe |