Skip to content

Commit f84b197

Browse files
committed
Patch the correct find_executable
1 parent 5622760 commit f84b197

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

tests/languages/python_test.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import mock
88
import pytest
99

10-
from pre_commit import parse_shebang
1110
from pre_commit.languages import python
1211

1312

@@ -45,12 +44,7 @@ def test_sys_executable_matches_does_not_match(v):
4544
),
4645
)
4746
def test_find_by_sys_executable(exe, realpath, expected):
48-
def mocked_find_executable(exe):
49-
return exe.rpartition('/')[2]
5047
with mock.patch.object(sys, 'executable', exe):
5148
with mock.patch.object(os.path, 'realpath', return_value=realpath):
52-
with mock.patch.object(
53-
parse_shebang, 'find_executable',
54-
side_effect=mocked_find_executable,
55-
):
49+
with mock.patch.object(python, 'find_executable', lambda x: x):
5650
assert python._find_by_sys_executable() == expected

0 commit comments

Comments
 (0)