1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-08 12:53:58 +01:00

Some improvements (#846)

* #833: do not require sudo on TravisCI

* #N/A: Add Python dev releases to TravisCI pipeline

Inspired by Brett Cannon's advise [1].

    1: https://snarky.ca/how-to-use-your-project-travis-to-help-test-python-itself/

* #837: try and kill proc and its children

* #N/A: show shell information on `thefuck --version`

* #N/A: omit default arguments to get_close_matches

* #842: add settings var to control number of close matches

* #N/A: remove `n` from the list of `get_closest`'s args
This commit is contained in:
Pablo Aguiar
2018-10-08 22:32:30 +02:00
committed by Vladimir Iakovlev
parent 5fd4f74701
commit 25142f81f8
25 changed files with 189 additions and 37 deletions

View File

@@ -2,11 +2,11 @@
import pytest
import warnings
from mock import Mock
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, \
get_valid_history_without_current, _cache
get_valid_history_without_current, _cache, get_close_matches
from thefuck.types import Command
@@ -50,6 +50,18 @@ class TestGetClosest(object):
fallback_to_first=False) is None
class TestGetCloseMatches(object):
@patch('thefuck.utils.difflib_get_close_matches')
def test_call_with_n(self, difflib_mock):
get_close_matches('', [], 1)
assert difflib_mock.call_args[0][2] == 1
@patch('thefuck.utils.difflib_get_close_matches')
def test_call_without_n(self, difflib_mock, settings):
get_close_matches('', [])
assert difflib_mock.call_args[0][2] == settings.get('num_close_matches')
@pytest.fixture
def get_aliases(mocker):
mocker.patch('thefuck.shells.shell.get_aliases',