From 46b28387db489b3c61c510c4ff62631f1021b8ce Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 3 Sep 2015 06:38:35 +0200 Subject: [PATCH] Rewrite test_double_connection. This caused various problems in the old form. --- tests/unit/misc/test_ipc.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/unit/misc/test_ipc.py b/tests/unit/misc/test_ipc.py index d38b27930..16944f7fe 100644 --- a/tests/unit/misc/test_ipc.py +++ b/tests/unit/misc/test_ipc.py @@ -228,6 +228,13 @@ class TestHandleConnection: record = caplog.records()[0] assert record.message == "No new connection to handle." + def test_double_connection(self, qlocalsocket, ipc_server, caplog): + ipc_server._socket = qlocalsocket + ipc_server.handle_connection() + message = ("Got new connection but ignoring it because we're still " + "handling another one.") + assert message in [rec.message for rec in caplog.records()] + def test_disconnected_immediately(self, ipc_server, caplog): socket = FakeSocket(state=QLocalSocket.UnconnectedState) ipc_server._server = FakeServer(socket) @@ -298,19 +305,6 @@ def test_normal(qtbot, tmpdir, ipc_server, mocker, has_cwd): assert spy[0] == [['foo'], expected_cwd] -def test_double_connection(qtbot, connected_socket, ipc_server, caplog): - spy = QSignalSpy(ipc_server.got_args) - error_spy = QSignalSpy(ipc_server.got_invalid_data) - with qtbot.waitSignal(ipc_server._server.newConnection, raising=True): - sent = ipc.send_to_running_instance('qutebrowser-test', []) - assert sent - assert not spy - assert not error_spy - message = ("Got new connection but ignoring it because we're still " - "handling another one.") - assert message in [rec.message for rec in caplog.records()] - - def test_disconnected_without_data(qtbot, connected_socket, ipc_server, caplog): """Disconnect without sending data.