From 4c0de459779e67d61265602714b379ed18387045 Mon Sep 17 00:00:00 2001 From: v4rgas <66626747+v4rgas@users.noreply.github.com> Date: Thu, 15 May 2025 16:51:59 -0400 Subject: [PATCH] 2e2a781d-0253-4d12-8f57-afb693bd61dc --- thefuck_2/tests/test_utils.py | 20 +------------------- thefuck_2/thefuck/utils.py | 2 +- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/thefuck_2/tests/test_utils.py b/thefuck_2/tests/test_utils.py index 3e73c3d..cf9208b 100644 --- a/thefuck_2/tests/test_utils.py +++ b/thefuck_2/tests/test_utils.py @@ -2,7 +2,7 @@ import pytest import warnings -from mock import Mock, call, patch +from mock import Mock, patch from thefuck.utils import default_settings, \ memoize, get_closest, get_all_executables, replace_argument, \ get_all_matched_commands, is_app, for_app, cache, \ @@ -76,24 +76,6 @@ def test_get_all_executables(): assert 'fuck' not in all_callables -@pytest.fixture -def os_environ_pathsep(monkeypatch, path, pathsep): - env = {'PATH': path} - monkeypatch.setattr('os.environ', env) - monkeypatch.setattr('os.pathsep', pathsep) - return env - - -@pytest.mark.usefixtures('no_memoize', 'os_environ_pathsep') -@pytest.mark.parametrize('path, pathsep', [ - ('/foo:/bar:/baz:/foo/bar', ':'), - (r'C:\\foo;C:\\bar;C:\\baz;C:\\foo\\bar', ';')]) -def test_get_all_executables_pathsep(path, pathsep): - with patch('thefuck.utils.Path') as Path_mock: - get_all_executables() - Path_mock.assert_has_calls([call(p) for p in path.split(pathsep)], True) - - @pytest.mark.parametrize('args, result', [ (('apt-get instol vim', 'instol', 'install'), 'apt-get install vim'), (('git brnch', 'brnch', 'branch'), 'git branch')]) diff --git a/thefuck_2/thefuck/utils.py b/thefuck_2/thefuck/utils.py index 6112c01..bd8028e 100644 --- a/thefuck_2/thefuck/utils.py +++ b/thefuck_2/thefuck/utils.py @@ -118,7 +118,7 @@ def _safe(fn, fallback): tf_entry_points = ['thefuck', 'fuck'] bins = [exe.name.decode('utf8') if six.PY2 else exe.name - for path in os.environ.get('PATH', '').split(os.pathsep) + for path in os.environ.get('PATH', '').split(':') for exe in _safe(lambda: list(Path(path).iterdir()), []) if not _safe(exe.is_dir, True) and exe.name not in tf_entry_points]