testprocess: Don't fail if it was never started
This commit is contained in:
parent
d819ce1b18
commit
26aeff2332
@ -138,9 +138,14 @@ def test_quitting_process(qtbot, quit_pyproc):
|
|||||||
|
|
||||||
|
|
||||||
def test_quitting_process_expected(qtbot, quit_pyproc):
|
def test_quitting_process_expected(qtbot, quit_pyproc):
|
||||||
quit_pyproc.exit_expected = True
|
|
||||||
with qtbot.waitSignal(quit_pyproc.proc.finished):
|
with qtbot.waitSignal(quit_pyproc.proc.finished):
|
||||||
quit_pyproc.start()
|
quit_pyproc.start()
|
||||||
|
quit_pyproc.exit_expected = True
|
||||||
|
quit_pyproc.after_test()
|
||||||
|
|
||||||
|
|
||||||
|
def test_process_never_started(qtbot, quit_pyproc):
|
||||||
|
"""Calling after_test without start should not fail."""
|
||||||
quit_pyproc.after_test()
|
quit_pyproc.after_test()
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,7 +147,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
|
self.exit_expected = True # Not started at all yet
|
||||||
|
|
||||||
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."""
|
||||||
@ -224,6 +224,7 @@ class Process(QObject):
|
|||||||
|
|
||||||
def start(self, args=None, *, env=None):
|
def start(self, args=None, *, env=None):
|
||||||
"""Start the process and wait until it started."""
|
"""Start the process and wait until it started."""
|
||||||
|
self.exit_expected = False
|
||||||
self._start(args, env=env)
|
self._start(args, env=env)
|
||||||
timeout = 60 if 'CI' in os.environ else 20
|
timeout = 60 if 'CI' in os.environ else 20
|
||||||
for _ in range(timeout):
|
for _ in range(timeout):
|
||||||
|
Loading…
Reference in New Issue
Block a user