From d5c5d09b18abcbc8250dea7c46566a253fce7b49 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 2 May 2017 09:12:06 +0200 Subject: [PATCH] Hopefully stabilize test_version When using QuteProcess here, we fight with it over who can read the output. Just use a raw QProcess instead. --- tests/end2end/test_invocations.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/end2end/test_invocations.py b/tests/end2end/test_invocations.py index 38d0e6eb9..9c1e993cb 100644 --- a/tests/end2end/test_invocations.py +++ b/tests/end2end/test_invocations.py @@ -162,23 +162,24 @@ def test_optimize(request, quteproc_new, capfd, level): quteproc_new.wait_for_quit() +@pytest.mark.not_frozen def test_version(request): """Test invocation with --version argument.""" - args = ['--version'] + _base_args(request.config) + args = ['-m', 'qutebrowser', '--version'] + _base_args(request.config) # can't use quteproc_new here because it's confused by # early process termination - proc = quteprocess.QuteProc(request) - proc.proc.setProcessChannelMode(QProcess.SeparateChannels) + proc = QProcess() + proc.setProcessChannelMode(QProcess.SeparateChannels) - try: - proc.start(args) - proc.wait_for_quit() - except testprocess.ProcessExited: - assert proc.proc.exitStatus() == QProcess.NormalExit - else: - pytest.fail("Process did not exit!") + proc.start(sys.executable, args) + ok = proc.waitForStarted(2000) + assert ok + ok = proc.waitForFinished(2000) + assert ok + assert proc.exitStatus() == QProcess.NormalExit - output = bytes(proc.proc.readAllStandardOutput()).decode('utf-8') + output = bytes(proc.readAllStandardOutput()).decode('utf-8') + print(output) assert re.search(r'^qutebrowser\s+v\d+(\.\d+)', output) is not None