ipc: Add some more tests for _atime_timer.

This commit is contained in:
Florian Bruhin 2015-09-10 08:02:19 +02:00
parent 1dba5b0bbd
commit 87ccc31cce
2 changed files with 16 additions and 1 deletions

View File

@ -366,7 +366,7 @@ class IPCServer(QObject):
self._socket.deleteLater() self._socket.deleteLater()
self._socket = None self._socket = None
self._timer.stop() self._timer.stop()
if self._atime_timer is not None: if self._atime_timer is not None: # pragma: no branch
self._atime_timer.stop() self._atime_timer.stop()
try: try:
self._atime_timer.timeout.disconnect(self.update_atime) self._atime_timer.timeout.disconnect(self.update_atime)

View File

@ -343,6 +343,21 @@ class TestListen:
assert old_atime != new_atime 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: class TestOnError: