1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-09-21 04:32:37 +01:00

Use pytest-docker-pexpect for func tests

This commit is contained in:
nvbn
2015-09-06 00:56:18 +03:00
parent 8bf4182f86
commit 8cc19daaaa
11 changed files with 155 additions and 216 deletions

View File

@@ -1,6 +1,3 @@
from pexpect import TIMEOUT
def _set_confirmation(proc, require):
proc.sendline(u'mkdir -p ~/.thefuck')
proc.sendline(
@@ -8,7 +5,7 @@ def _set_confirmation(proc, require):
require))
def with_confirmation(proc):
def with_confirmation(proc, TIMEOUT):
"""Ensures that command can be fixed when confirmation enabled."""
_set_confirmation(proc, True)
@@ -23,19 +20,19 @@ def with_confirmation(proc):
assert proc.expect([TIMEOUT, u'test'])
def history_changed(proc, to):
def history_changed(proc, TIMEOUT, to):
"""Ensures that history changed."""
proc.send('\033[A')
assert proc.expect([TIMEOUT, to])
def history_not_changed(proc):
def history_not_changed(proc, TIMEOUT):
"""Ensures that history not changed."""
proc.send('\033[A')
assert proc.expect([TIMEOUT, u'fuck'])
def select_command_with_arrows(proc):
def select_command_with_arrows(proc, TIMEOUT):
"""Ensures that command can be selected with arrow keys."""
_set_confirmation(proc, True)
@@ -55,7 +52,7 @@ def select_command_with_arrows(proc):
assert proc.expect([TIMEOUT, u'Not a git repository'])
def refuse_with_confirmation(proc):
def refuse_with_confirmation(proc, TIMEOUT):
"""Ensures that fix can be refused when confirmation enabled."""
_set_confirmation(proc, True)
@@ -70,7 +67,7 @@ def refuse_with_confirmation(proc):
assert proc.expect([TIMEOUT, u'Aborted'])
def without_confirmation(proc):
def without_confirmation(proc, TIMEOUT):
"""Ensures that command can be fixed when confirmation disabled."""
_set_confirmation(proc, False)