From f84b19748d7d0dfda496b73ab365a2e64b377696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 15 Aug 2019 19:28:07 +0300 Subject: [PATCH] Patch the correct find_executable --- tests/languages/python_test.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/languages/python_test.py b/tests/languages/python_test.py index debf9753..d9d8ecd5 100644 --- a/tests/languages/python_test.py +++ b/tests/languages/python_test.py @@ -7,7 +7,6 @@ import sys import mock import pytest -from pre_commit import parse_shebang from pre_commit.languages import python @@ -45,12 +44,7 @@ def test_sys_executable_matches_does_not_match(v): ), ) def test_find_by_sys_executable(exe, realpath, expected): - def mocked_find_executable(exe): - return exe.rpartition('/')[2] with mock.patch.object(sys, 'executable', exe): with mock.patch.object(os.path, 'realpath', return_value=realpath): - with mock.patch.object( - parse_shebang, 'find_executable', - side_effect=mocked_find_executable, - ): + with mock.patch.object(python, 'find_executable', lambda x: x): assert python._find_by_sys_executable() == expected