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:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user