home · contact · privacy
Don't kill testing keyboard and server input simulation loops after timeout.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 15 Sep 2025 21:49:43 +0000 (23:49 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 15 Sep 2025 21:49:43 +0000 (23:49 +0200)
ircplom/testing.py

index f57c59fbd6d8e74470caf0c1340469a0f2844ba4..f72f731fb3c64e1a1736554c7c8375c598579287 100644 (file)
@@ -46,7 +46,7 @@ class TestTerminal(QueueMixin, TerminalInterface):
             try:
                 to_yield = self._q_keypresses.get(timeout=0.1)
             except QueueEmpty:
-                break
+                yield None
             yield TuiEvent.affector('handle_keyboard_event'
                                     ).kw(typed_in=to_yield)
 
@@ -75,7 +75,7 @@ class _FakeIrcConnection(IrcConnection):
             try:
                 msg = self._q_server_msgs.get(timeout=0.1)
             except QueueEmpty:
-                break
+                yield None
             yield self._make_recv_event(IrcMessage.from_raw(msg))
 
 
@@ -123,11 +123,9 @@ class TestingClientTui(ClientTui):
         while True:
             self._playbook_idx += 1
             line = self._playbook[self._playbook_idx]
-            if not line.strip():
+            if line[:1] == '#' or not line.strip():
                 continue
             context, msg = line.split(' ', maxsplit=1)
-            if context == '#':
-                continue
             if context == '>':
                 for c in msg:
                     self._q_keypresses.put(c)