bdd: Add a "qutebrowser should quit" step.
This commit is contained in:
parent
6e390bdc01
commit
9c5974c054
@ -460,3 +460,10 @@ def clipboard_contains_multiline(qtbot, qapp, content):
|
|||||||
expected = textwrap.dedent(content)
|
expected = textwrap.dedent(content)
|
||||||
_wait_for_clipboard(qtbot, qapp.clipboard(), QClipboard.Clipboard,
|
_wait_for_clipboard(qtbot, qapp.clipboard(), QClipboard.Clipboard,
|
||||||
expected)
|
expected)
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.then("qutebrowser should quit")
|
||||||
|
def should_quit(qtbot, quteproc):
|
||||||
|
quteproc.exit_expected = True
|
||||||
|
with qtbot.waitSignal(quteproc.proc.finished):
|
||||||
|
pass
|
||||||
|
@ -118,6 +118,13 @@ def test_quitting_process(qtbot, quit_pyproc):
|
|||||||
quit_pyproc.after_test()
|
quit_pyproc.after_test()
|
||||||
|
|
||||||
|
|
||||||
|
def test_quitting_process_expected(qtbot, quit_pyproc):
|
||||||
|
quit_pyproc.exit_expected = True
|
||||||
|
with qtbot.waitSignal(quit_pyproc.proc.finished):
|
||||||
|
quit_pyproc.start()
|
||||||
|
quit_pyproc.after_test()
|
||||||
|
|
||||||
|
|
||||||
def test_wait_signal_raising(qtbot):
|
def test_wait_signal_raising(qtbot):
|
||||||
"""testprocess._wait_signal should raise by default."""
|
"""testprocess._wait_signal should raise by default."""
|
||||||
proc = testprocess.Process()
|
proc = testprocess.Process()
|
||||||
|
@ -123,6 +123,7 @@ class Process(QObject):
|
|||||||
_invalid: A list of lines which could not be parsed.
|
_invalid: A list of lines which could not be parsed.
|
||||||
_data: A list of parsed lines.
|
_data: A list of parsed lines.
|
||||||
proc: The QProcess for the underlying process.
|
proc: The QProcess for the underlying process.
|
||||||
|
exit_expected: Whether the process is expected to quit.
|
||||||
|
|
||||||
Signals:
|
Signals:
|
||||||
ready: Emitted when the server finished starting up.
|
ready: Emitted when the server finished starting up.
|
||||||
@ -140,6 +141,7 @@ class Process(QObject):
|
|||||||
self._data = []
|
self._data = []
|
||||||
self.proc = QProcess()
|
self.proc = QProcess()
|
||||||
self.proc.setReadChannel(QProcess.StandardError)
|
self.proc.setReadChannel(QProcess.StandardError)
|
||||||
|
self.exit_expected = False
|
||||||
|
|
||||||
def _log(self, line):
|
def _log(self, line):
|
||||||
"""Add the given line to the captured log output."""
|
"""Add the given line to the captured log output."""
|
||||||
@ -242,8 +244,9 @@ class Process(QObject):
|
|||||||
raise InvalidLine(self._invalid)
|
raise InvalidLine(self._invalid)
|
||||||
|
|
||||||
self.clear_data()
|
self.clear_data()
|
||||||
if not self.is_running():
|
if not self.is_running() and not self.exit_expected:
|
||||||
raise ProcessExited
|
raise ProcessExited
|
||||||
|
self.exit_expected = False
|
||||||
|
|
||||||
def clear_data(self):
|
def clear_data(self):
|
||||||
"""Clear the collected data."""
|
"""Clear the collected data."""
|
||||||
|
Loading…
Reference in New Issue
Block a user