Пример #1
0
 def shell(self):
     return shells.Generic()
Пример #2
0
import pytest
from thefuck import shells
from thefuck import conf, const
from thefuck.system import Path

shells.shell = shells.Generic()


def pytest_addoption(parser):
    """Adds `--enable-functional` argument."""
    group = parser.getgroup("thefuck")
    group.addoption('--enable-functional',
                    action="store_true",
                    default=False,
                    help="Enable functional tests")


@pytest.fixture
def no_memoize(monkeypatch):
    monkeypatch.setattr('thefuck.utils.memoize.disabled', True)


@pytest.fixture(autouse=True)
def settings(request):
    def _reset_settings():
        conf.settings.clear()
        conf.settings.update(const.DEFAULT_SETTINGS)

    request.addfinalizer(_reset_settings)
    conf.settings.user_dir = Path('~/.thefuck')
    return conf.settings
Пример #3
0
 def test_to_shell(self):
     assert shells.Generic().to_shell('pwd') == 'pwd'
Пример #4
0
 def test_put_to_history(self, builtins_open):
     assert shells.Generic().put_to_history('ls') is None
     assert builtins_open.call_count == 0
Пример #5
0
 def test_from_shell(self):
     assert shells.Generic().from_shell('pwd') == 'pwd'