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: