bdd: Allow to run invalid commands via quteproc
This commit is contained in:
parent
4a7a2e61d3
commit
2f60073cdf
@ -123,10 +123,18 @@ def run_command(quteproc, httpbin, command):
|
||||
count = int(count)
|
||||
else:
|
||||
count = None
|
||||
|
||||
invalid_tag = ' (invalid command)'
|
||||
if command.endswith(invalid_tag):
|
||||
command = command[:-len(invalid_tag)]
|
||||
invalid = True
|
||||
else:
|
||||
invalid = False
|
||||
|
||||
command = command.replace('(port)', str(httpbin.port))
|
||||
command = command.replace('(testdata)', utils.abs_datapath())
|
||||
|
||||
quteproc.send_cmd(command, count=count)
|
||||
quteproc.send_cmd(command, count=count, invalid=invalid)
|
||||
|
||||
|
||||
@bdd.when(bdd.parsers.parse("I reload"))
|
||||
|
@ -330,8 +330,13 @@ class QuteProc(testprocess.Process):
|
||||
finally:
|
||||
super().after_test()
|
||||
|
||||
def send_cmd(self, command, count=None):
|
||||
"""Send a command to the running qutebrowser instance."""
|
||||
def send_cmd(self, command, count=None, invalid=False):
|
||||
"""Send a command to the running qutebrowser instance.
|
||||
|
||||
Args:
|
||||
count: The count to pass to the command.
|
||||
invalid: If True, we don't wait for "command called: ..." in the log
|
||||
"""
|
||||
summary = command
|
||||
if count is not None:
|
||||
summary += ' (count {})'.format(count)
|
||||
@ -346,8 +351,9 @@ class QuteProc(testprocess.Process):
|
||||
|
||||
ipc.send_to_running_instance(self._ipc_socket, [command],
|
||||
target_arg='')
|
||||
self.wait_for(category='commands', module='command', function='run',
|
||||
message='command called: *')
|
||||
if not invalid:
|
||||
self.wait_for(category='commands', module='command',
|
||||
function='run', message='command called: *')
|
||||
|
||||
def get_setting(self, sect, opt):
|
||||
"""Get the value of a qutebrowser setting."""
|
||||
|
Loading…
Reference in New Issue
Block a user