mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 06:23:53 +01:00
riotctrl_shell.tests: add capability to access history of commands
This commit is contained in:
parent
bf93d85d4e
commit
ae14386736
12
dist/pythonlibs/riotctrl_shell/tests/common.py
vendored
12
dist/pythonlibs/riotctrl_shell/tests/common.py
vendored
@ -10,17 +10,25 @@ import contextlib
|
||||
class MockSpawn():
|
||||
def __init__(self, ctrl, *args, **kwargs):
|
||||
self.ctrl = ctrl
|
||||
self.last_command = None
|
||||
self.commands = []
|
||||
# set some expected attributes
|
||||
self.before = None
|
||||
self.echo = False
|
||||
|
||||
@property
|
||||
def last_command(self):
|
||||
if self.commands:
|
||||
return self.commands[-1]
|
||||
else:
|
||||
return None
|
||||
|
||||
def read_nonblocking(self, size=1, timeout=-1):
|
||||
# do nothing, only used to flush pexpect output
|
||||
pass
|
||||
|
||||
def sendline(self, line, *args, **kwargs):
|
||||
self.last_command = line
|
||||
if line:
|
||||
self.commands.append(line)
|
||||
if self.ctrl.output is None:
|
||||
# just echo last input for before (what replwrap is assembling
|
||||
# output from)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user