|
15 | 15 | from pre_commit.util import make_executable |
16 | 16 |
|
17 | 17 |
|
18 | | -@pytest.mark.parametrize( |
19 | | - ('s', 'expected'), |
20 | | - ( |
21 | | - (b'', ()), |
22 | | - (b'#!/usr/bin/python', ('/usr/bin/python',)), |
23 | | - (b'#!/usr/bin/env python', ('python',)), |
24 | | - (b'#! /usr/bin/python', ('/usr/bin/python',)), |
25 | | - (b'#!/usr/bin/foo python', ('/usr/bin/foo', 'python')), |
26 | | - (b'\xf9\x93\x01\x42\xcd', ()), |
27 | | - (b'#!\xf9\x93\x01\x42\xcd', ()), |
28 | | - (b'#!\x00\x00\x00\x00', ()), |
29 | | - ), |
30 | | -) |
31 | | -def test_parse_bytesio(s, expected): |
32 | | - assert parse_shebang.parse_bytesio(io.BytesIO(s)) == expected |
33 | | - |
34 | | - |
35 | 18 | def test_file_doesnt_exist(): |
36 | 19 | assert parse_shebang.parse_filename('herp derp derp') == () |
37 | 20 |
|
38 | 21 |
|
39 | | -@pytest.mark.xfail( |
40 | | - sys.platform == 'win32', reason='Windows says everything is X_OK', |
41 | | -) |
42 | | -def test_file_not_executable(tmpdir): |
43 | | - x = tmpdir.join('f') |
44 | | - x.write_text('#!/usr/bin/env python', encoding='UTF-8') |
45 | | - assert parse_shebang.parse_filename(x.strpath) == () |
46 | | - |
47 | | - |
48 | 22 | def test_simple_case(tmpdir): |
49 | 23 | x = tmpdir.join('f') |
50 | 24 | x.write_text('#!/usr/bin/env python', encoding='UTF-8') |
|
0 commit comments