mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-24 14:12:34 +01:00
#682: Add functional tests for instant mode
This commit is contained in:
@@ -3,22 +3,35 @@ from tests.functional.plots import with_confirmation, without_confirmation, \
|
||||
refuse_with_confirmation, history_changed, history_not_changed, \
|
||||
select_command_with_arrows, how_to_configure
|
||||
|
||||
containers = ((u'thefuck/python3-bash',
|
||||
u'FROM python:3',
|
||||
u'bash'),
|
||||
(u'thefuck/python2-bash',
|
||||
u'FROM python:2',
|
||||
u'bash'))
|
||||
|
||||
python_3 = (u'thefuck/python3-bash',
|
||||
u'FROM python:3',
|
||||
u'sh')
|
||||
|
||||
python_2 = (u'thefuck/python2-bash',
|
||||
u'FROM python:2',
|
||||
u'sh')
|
||||
|
||||
|
||||
@pytest.fixture(params=containers)
|
||||
init_bashrc = u'''echo '
|
||||
export SHELL=/bin/bash
|
||||
export PS1="$ "
|
||||
echo > $HISTFILE
|
||||
eval $(thefuck --alias {})
|
||||
' > ~/.bashrc'''
|
||||
|
||||
|
||||
@pytest.fixture(params=[(python_3, False),
|
||||
(python_3, True),
|
||||
(python_2, False)])
|
||||
def proc(request, spawnu, TIMEOUT):
|
||||
proc = spawnu(*request.param)
|
||||
container, instant_mode = request.param
|
||||
proc = spawnu(*container)
|
||||
proc.sendline(u"pip install /src")
|
||||
assert proc.expect([TIMEOUT, u'Successfully installed'])
|
||||
proc.sendline(u"export PS1='$ '")
|
||||
proc.sendline(u'eval $(thefuck --alias)')
|
||||
proc.sendline(u'echo > $HISTFILE')
|
||||
proc.sendline(init_bashrc.format(
|
||||
u'--enable-experimental-instant-mode' if instant_mode else ''))
|
||||
proc.sendline(u"bash")
|
||||
return proc
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user