diff options
author | Florian Bruhin <git@the-compiler.org> | 2016-08-02 12:44:24 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2016-08-02 14:26:11 +0200 |
commit | c2bf595b792516e52928f803256e3dfafc94ef21 (patch) | |
tree | 96a999beb3709a49857e847d5b2cb15b678d99e1 | |
parent | f73f3a2001c20f55640a67b1c31ed16a19d8a326 (diff) | |
download | qutebrowser-c2bf595b792516e52928f803256e3dfafc94ef21.tar.gz qutebrowser-c2bf595b792516e52928f803256e3dfafc94ef21.zip |
Don't use QSignalSpy in IPC test
Fixes #1727.
For another testcase in the same file we still need to use it until
pytest-qt has a MultiSignalBlocker.args.
-rw-r--r-- | tests/unit/misc/test_ipc.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/unit/misc/test_ipc.py b/tests/unit/misc/test_ipc.py index faf23edf0..e16041825 100644 --- a/tests/unit/misc/test_ipc.py +++ b/tests/unit/misc/test_ipc.py @@ -532,32 +532,33 @@ class TestSendToRunningInstance: @pytest.mark.linux(reason="Causes random trouble on Windows and OS X") def test_normal(self, qtbot, tmpdir, ipc_server, mocker, has_cwd): ipc_server.listen() - raw_spy = QSignalSpy(ipc_server.got_raw) with qtbot.assertNotEmitted(ipc_server.got_invalid_data): with qtbot.waitSignal(ipc_server.got_args, timeout=5000) as blocker: - with tmpdir.as_cwd(): - if not has_cwd: - m = mocker.patch('qutebrowser.misc.ipc.os') - m.getcwd.side_effect = OSError - sent = ipc.send_to_running_instance('qute-test', ['foo'], - None) + with qtbot.waitSignal(ipc_server.got_raw, + timeout=5000) as raw_blocker: + with tmpdir.as_cwd(): + if not has_cwd: + m = mocker.patch('qutebrowser.misc.ipc.os') + m.getcwd.side_effect = OSError + sent = ipc.send_to_running_instance( + 'qute-test', ['foo'], None) - assert sent + assert sent expected_cwd = str(tmpdir) if has_cwd else '' assert blocker.args == [['foo'], '', expected_cwd] - assert len(raw_spy) == 1 - assert len(raw_spy[0]) == 1 raw_expected = {'args': ['foo'], 'target_arg': None, 'version': qutebrowser.__version__, 'protocol_version': ipc.PROTOCOL_VERSION} if has_cwd: raw_expected['cwd'] = str(tmpdir) - parsed = json.loads(raw_spy[0][0].decode('utf-8')) + + assert len(raw_blocker.args) == 1 + parsed = json.loads(raw_blocker.args[0].decode('utf-8')) assert parsed == raw_expected def test_socket_error(self): |