From 87ccc31ccea6ae30be9ed7eeea296386e006bb62 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 10 Sep 2015 08:02:19 +0200 Subject: [PATCH] ipc: Add some more tests for _atime_timer. --- qutebrowser/misc/ipc.py | 2 +- tests/unit/misc/test_ipc.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/qutebrowser/misc/ipc.py b/qutebrowser/misc/ipc.py index 67182a828..a7114c5ac 100644 --- a/qutebrowser/misc/ipc.py +++ b/qutebrowser/misc/ipc.py @@ -366,7 +366,7 @@ class IPCServer(QObject): self._socket.deleteLater() self._socket = None self._timer.stop() - if self._atime_timer is not None: + if self._atime_timer is not None: # pragma: no branch self._atime_timer.stop() try: self._atime_timer.timeout.disconnect(self.update_atime) diff --git a/tests/unit/misc/test_ipc.py b/tests/unit/misc/test_ipc.py index 34d709458..29f6f7d99 100644 --- a/tests/unit/misc/test_ipc.py +++ b/tests/unit/misc/test_ipc.py @@ -343,6 +343,21 @@ class TestListen: assert old_atime != new_atime + @pytest.mark.posix + def test_atime_update_no_name(self, qtbot, caplog, ipc_server): + with caplog.atLevel(logging.ERROR): + ipc_server.update_atime() + + records = caplog.records() + assert len(records) == 1 + assert records[0].msg == "In update_atime with no server path!" + + @pytest.mark.posix + def test_atime_shutdown_typeerror(self, qtbot, ipc_server): + """This should never happen, but let's handle it gracefully.""" + ipc_server._atime_timer.timeout.disconnect(ipc_server.update_atime) + ipc_server.shutdown() + class TestOnError: