Skip to content

Commit c377830

Browse files
committed
Mock find_executable for find_by_sys_executable test
1 parent fa2e154 commit c377830

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

tests/languages/python_test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ def test_sys_executable_matches_does_not_match(v):
4444
),
4545
)
4646
def test_find_by_sys_executable(exe, realpath, expected):
47+
def mocked_find_executable(exe):
48+
return exe.rpartition('/')[2]
4749
with mock.patch.object(sys, 'executable', exe):
4850
with mock.patch('os.path.realpath', return_value=realpath):
49-
assert python._find_by_sys_executable() == expected
51+
with mock.patch(
52+
'pre_commit.parse_shebang.find_executable',
53+
side_effect=mocked_find_executable,
54+
):
55+
assert python._find_by_sys_executable() == expected

0 commit comments

Comments
 (0)