1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-30 14:44:05 +00:00

#441: Remove shells methods wrappers

This commit is contained in:
nvbn
2016-01-29 13:09:40 +03:00
parent b5dc7aab6d
commit fe07fcaa62
34 changed files with 86 additions and 119 deletions

View File

@@ -1,7 +1,10 @@
from pathlib import Path
import pytest
from thefuck import shells
from thefuck import conf
shells.shell = shells.Generic()
def pytest_addoption(parser):
"""Adds `--run-without-docker` argument."""
@@ -46,3 +49,14 @@ def functional(request):
@pytest.fixture
def source_root():
return Path(__file__).parent.parent.resolve()
@pytest.fixture
def set_shell(monkeypatch, request):
def _set(cls):
shell = cls()
monkeypatch.setattr('thefuck.shells.shell', shell)
request.addfinalizer()
return shell
return _set

View File

@@ -1,6 +0,0 @@
import pytest
@pytest.fixture(autouse=True)
def generic_shell(monkeypatch):
monkeypatch.setattr('thefuck.shells.and_', lambda *x: u' && '.join(x))

View File

@@ -1,5 +1,5 @@
from thefuck import shells
from thefuck.rules.git_branch_list import match, get_new_command
from thefuck.shells import shell
from tests.utils import Command
@@ -16,4 +16,4 @@ def test_not_match():
def test_get_new_command():
assert (get_new_command(Command('git branch list')) ==
shells.and_('git branch --delete list', 'git branch'))
shell.and_('git branch --delete list', 'git branch'))

View File

@@ -5,7 +5,7 @@ from tests.utils import Command
@pytest.fixture
def history(mocker):
return mocker.patch('thefuck.rules.history.get_history',
return mocker.patch('thefuck.shells.shell.get_history',
return_value=['le cat', 'fuck', 'ls cat',
'diff x', 'nocommand x'])

View File

@@ -18,4 +18,5 @@ def history_lines(mocker):
mock = mocker.patch('io.open')
mock.return_value.__enter__ \
.return_value.readlines.return_value = lines
return aux

View File

@@ -4,7 +4,7 @@ import pytest
from thefuck.shells import Bash
@pytest.mark.usefixtures('isfile')
@pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache')
class TestBash(object):
@pytest.fixture
def shell(self):

View File

@@ -4,7 +4,7 @@ import pytest
from thefuck.shells import Fish
@pytest.mark.usefixtures('isfile')
@pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache')
class TestFish(object):
@pytest.fixture
def shell(self):

View File

@@ -4,7 +4,7 @@ import pytest
from thefuck.shells.tcsh import Tcsh
@pytest.mark.usefixtures('isfile')
@pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache')
class TestTcsh(object):
@pytest.fixture
def shell(self):

View File

@@ -4,7 +4,7 @@ import pytest
from thefuck.shells.zsh import Zsh
@pytest.mark.usefixtures('isfile')
@pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache')
class TestZsh(object):
@pytest.fixture
def shell(self):

View File

@@ -103,11 +103,6 @@ class TestCommand(object):
monkeypatch.setattr('thefuck.types.Command._wait_output',
staticmethod(lambda *_: True))
@pytest.fixture(autouse=True)
def generic_shell(self, monkeypatch):
monkeypatch.setattr('thefuck.shells.from_shell', lambda x: x)
monkeypatch.setattr('thefuck.shells.to_shell', lambda x: x)
def test_from_script_calls(self, Popen, settings):
settings.env = {}
assert Command.from_raw_script(

View File

@@ -50,7 +50,7 @@ class TestGetClosest(object):
@pytest.fixture
def get_aliases(mocker):
mocker.patch('thefuck.shells.get_aliases',
mocker.patch('thefuck.shells.shell.get_aliases',
return_value=['vim', 'apt-get', 'fsck', 'fuck'])