77import mock
88import pytest
99
10+ import pre_commit .parse_shebang
1011from pre_commit .languages import python
1112
1213
@@ -35,7 +36,7 @@ def test_sys_executable_matches_does_not_match(v):
3536
3637
3738@pytest .mark .parametrize (
38- 'exe, realpath, expected' , (
39+ ( 'exe' , ' realpath' , ' expected') , (
3940 ('/usr/bin/python3' , '/usr/bin/python3.7' , 'python3' ),
4041 ('/usr/bin/python' , '/usr/bin/python3.7' , 'python3.7' ),
4142 ('/usr/bin/python' , '/usr/bin/python' , None ),
@@ -47,9 +48,9 @@ def test_find_by_sys_executable(exe, realpath, expected):
4748 def mocked_find_executable (exe ):
4849 return exe .rpartition ('/' )[2 ]
4950 with mock .patch .object (sys , 'executable' , exe ):
50- with mock .patch ( ' os.path. realpath' , return_value = realpath ):
51- with mock .patch (
52- ' pre_commit.parse_shebang. find_executable' ,
51+ with mock .patch . object ( os .path , ' realpath' , return_value = realpath ):
52+ with mock .patch . object (
53+ pre_commit .parse_shebang , ' find_executable' ,
5354 side_effect = mocked_find_executable ,
5455 ):
5556 assert python ._find_by_sys_executable () == expected
0 commit comments