From 4af0a332c3d292932998f2ae550abc7af95f1ede Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 3 Jan 2015 02:48:22 -0500 Subject: Rewrite skip/xfail --- setuptools/tests/test_easy_install.py | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'setuptools') diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index fc1a26d0..b364eca2 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -427,25 +427,27 @@ class TestScriptHeader: non_ascii_exe = '/Users/José/bin/python' exe_with_spaces = r'C:\Program Files\Python33\python.exe' + @pytest.mark.skipif( + sys.platform.startswith('java') and is_sh(sys.executable), + reason="Test cannot run under java when executable is sh" + ) def test_get_script_header(self): - if not sys.platform.startswith('java') or not is_sh(sys.executable): - # This test is for non-Jython platforms - expected = '#!%s\n' % nt_quote_arg(os.path.normpath(sys.executable)) - assert get_script_header('#!/usr/local/bin/python') == expected - expected = '#!%s -x\n' % nt_quote_arg(os.path.normpath(sys.executable)) - assert get_script_header('#!/usr/bin/python -x') == expected - candidate = get_script_header('#!/usr/bin/python', - executable=self.non_ascii_exe) - assert candidate == '#!%s -x\n' % self.non_ascii_exe - candidate = get_script_header('#!/usr/bin/python', - executable=self.exe_with_spaces) - assert candidate == '#!"%s"\n' % self.exe_with_spaces - + expected = '#!%s\n' % nt_quote_arg(os.path.normpath(sys.executable)) + assert get_script_header('#!/usr/local/bin/python') == expected + expected = '#!%s -x\n' % nt_quote_arg(os.path.normpath(sys.executable)) + assert get_script_header('#!/usr/bin/python -x') == expected + candidate = get_script_header('#!/usr/bin/python', + executable=self.non_ascii_exe) + assert candidate == '#!%s -x\n' % self.non_ascii_exe + candidate = get_script_header('#!/usr/bin/python', + executable=self.exe_with_spaces) + assert candidate == '#!"%s"\n' % self.exe_with_spaces + + @pytest.mark.xfail( + compat.PY3 and os.environ.get("LC_CTYPE") in (None, "C", "POSIX"), + reason="Test fails in this locale on Python 3" + ) def test_get_script_header_jython_workaround(self): - # This test doesn't work with Python 3 in some locales - if compat.PY3 and os.environ.get("LC_CTYPE") in (None, "C", "POSIX"): - return - class java: class lang: class System: -- cgit v1.2.3