Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/rules/test_no_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@pytest.fixture(autouse=True)
def get_all_executables(mocker):
mocker.patch('thefuck.rules.no_command.get_all_executables',
return_value=['vim', 'fsck', 'git', 'go'])
return_value=['vim', 'fsck', 'git', 'go', 'python'])


@pytest.fixture(autouse=True)
Expand All @@ -20,6 +20,7 @@ def history_without_current(mocker):
@pytest.mark.parametrize('script, output', [
('vom file.py', 'vom: not found'),
('fucck', 'fucck: not found'),
('puthon', "'puthon' is not recognized as an internal or external command"),
('got commit', 'got: command not found')])
def test_match(mocker, script, output):
mocker.patch('thefuck.rules.no_command.which', return_value=None)
Expand Down
3 changes: 2 additions & 1 deletion thefuck/rules/no_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
@sudo_support
def match(command):
return (not which(command.script_parts[0])
and 'not found' in command.output
and ('not found' in command.output
or 'is not recognized as' in command.output)
and bool(get_close_matches(command.script_parts[0],
get_all_executables())))

Expand Down