예제 #1
0
def test_shebang_posix_on_path(tmpdir):
    exe = tmpdir.join(f'python{sys.version_info[0]}').ensure()
    make_executable(exe)

    with patch_platform('posix'), patch_lookup_path((tmpdir.strpath, )):
        with patch_sys_exe('python'):
            assert shebang() == f'#!/usr/bin/env python{sys.version_info[0]}'
예제 #2
0
def test_shebang_posix_on_path(tmpdir):
    tmpdir.join(f'python{sys.version_info[0]}').ensure()

    with mock.patch.object(sys, 'platform', 'posix'):
        with mock.patch.object(os, 'defpath', tmpdir.strpath):
            expected = f'#!/usr/bin/env python{sys.version_info[0]}'
            assert shebang() == expected
def test_shebang_posix_on_path(tmpdir):
    tmpdir.join('python{}'.format(sys.version_info[0])).ensure()

    with mock.patch.object(sys, 'platform', 'posix'):
        with mock.patch.object(os, 'defpath', tmpdir.strpath):
            expected = '#!/usr/bin/env python{}'.format(sys.version_info[0])
            assert shebang() == expected
예제 #4
0
def test_shebang_posix_not_on_path():
    with mock.patch.object(sys, 'platform', 'posix'):
        with mock.patch.object(os, 'defpath', ''):
            assert shebang() == '#!/usr/bin/env python'
예제 #5
0
def test_shebang_windows():
    with mock.patch.object(sys, 'platform', 'win32'):
        assert shebang() == '#!/usr/bin/env python'
예제 #6
0
def test_shebang_posix_not_on_path():
    with patch_platform('posix'), patch_lookup_path(()):
        with patch_sys_exe('python3.6'):
            assert shebang() == '#!/usr/bin/env python3.6'
예제 #7
0
def test_shebang_windows():
    with patch_platform('win32'), patch_sys_exe('python.exe'):
        assert shebang() == '#!/usr/bin/env python.exe'
def test_shebang_posix_not_on_path():
    with mock.patch.object(sys, 'platform', 'posix'):
        with mock.patch.object(os, 'defpath', ''):
            assert shebang() == '#!/usr/bin/env python'
def test_shebang_windows():
    with mock.patch.object(sys, 'platform', 'win32'):
        assert shebang() == '#!/usr/bin/env python'