From 26aeff2332b69df208d7efd00c1a1fa6847e82fe Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 6 Sep 2016 08:03:56 +0200 Subject: [PATCH] testprocess: Don't fail if it was never started --- tests/end2end/fixtures/test_testprocess.py | 7 ++++++- tests/end2end/fixtures/testprocess.py | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/end2end/fixtures/test_testprocess.py b/tests/end2end/fixtures/test_testprocess.py index ec7e6bb82..91b45cfce 100644 --- a/tests/end2end/fixtures/test_testprocess.py +++ b/tests/end2end/fixtures/test_testprocess.py @@ -138,9 +138,14 @@ def test_quitting_process(qtbot, quit_pyproc): 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.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() diff --git a/tests/end2end/fixtures/testprocess.py b/tests/end2end/fixtures/testprocess.py index c8868e2a5..0e8f5d639 100644 --- a/tests/end2end/fixtures/testprocess.py +++ b/tests/end2end/fixtures/testprocess.py @@ -147,7 +147,7 @@ class Process(QObject): self._data = [] self.proc = QProcess() self.proc.setReadChannel(QProcess.StandardError) - self.exit_expected = False + self.exit_expected = True # Not started at all yet def _log(self, line): """Add the given line to the captured log output.""" @@ -224,6 +224,7 @@ class Process(QObject): def start(self, args=None, *, env=None): """Start the process and wait until it started.""" + self.exit_expected = False self._start(args, env=env) timeout = 60 if 'CI' in os.environ else 20 for _ in range(timeout):