1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-19 04:21:14 +00:00
thefuck/tests/functional/test_bash.py

53 lines
1.5 KiB
Python
Raw Normal View History

2015-07-24 03:56:21 +03:00
import pytest
from tests.functional.plots import with_confirmation, without_confirmation, \
2015-07-30 18:28:20 +03:00
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'))
2015-07-24 03:56:21 +03:00
2015-07-29 16:30:32 +03:00
@pytest.fixture(params=containers)
def proc(request, spawnu, TIMEOUT):
proc = spawnu(*request.param)
proc.sendline(u"pip install /src")
assert proc.expect([TIMEOUT, u'Successfully installed'])
2015-07-29 16:30:32 +03:00
proc.sendline(u"export PS1='$ '")
2015-09-01 18:36:25 +03:00
proc.sendline(u'eval $(thefuck --alias)')
2015-07-31 15:04:06 +03:00
proc.sendline(u'echo > $HISTFILE')
2015-07-29 16:30:32 +03:00
return proc
2015-09-06 01:13:44 +03:00
@pytest.mark.functional
def test_with_confirmation(proc, TIMEOUT):
with_confirmation(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'echo test')
2015-07-30 18:28:20 +03:00
2015-09-06 01:13:44 +03:00
@pytest.mark.functional
def test_select_command_with_arrows(proc, TIMEOUT):
select_command_with_arrows(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'git help')
2015-07-24 03:56:21 +03:00
2015-09-06 01:13:44 +03:00
@pytest.mark.functional
def test_refuse_with_confirmation(proc, TIMEOUT):
refuse_with_confirmation(proc, TIMEOUT)
history_not_changed(proc, TIMEOUT)
2015-07-24 23:14:58 +03:00
2015-09-06 01:13:44 +03:00
@pytest.mark.functional
def test_without_confirmation(proc, TIMEOUT):
without_confirmation(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'echo test')
@pytest.mark.functional
def test_how_to_configure_alias(proc, TIMEOUT):
2017-03-28 12:28:34 +02:00
proc.sendline('unset -f fuck')
how_to_configure(proc, TIMEOUT)