home · contact · privacy
Add SIGWINCH testing capability.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 27 Nov 2025 22:47:26 +0000 (23:47 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 27 Nov 2025 22:47:26 +0000 (23:47 +0100)
src/ircplom/testing.py

index a84e3428dd4b52047bb2a3ac6905449b076eba7a..0199e52cc2fb744cd5e241633a6ecba5d2468b17 100644 (file)
@@ -1,9 +1,12 @@
 'Basic testing.'
+# built-ins
 from contextlib import contextmanager
 from queue import SimpleQueue, Empty as QueueEmpty
 from pathlib import Path
+from signal import raise_signal, SIGWINCH
 from time import sleep
 from typing import Callable, Generator, Iterator, Optional
+# ourselves
 from ircplom.events import Event, Loop, QueueMixin
 from ircplom.client import IrcConnection, IrcConnSetup
 from ircplom.client_tui import ClientKnowingTui, ClientTui
@@ -418,6 +421,10 @@ class _Playbook:
             cmd_name, args = self._line_log_and_parse(*self._current_line)
             if cmd_name == _MARK_PROMPT:
                 assert self.put_keypress is not None
+                if args[0] == 'raise_sigwinch':
+                    args = ('',)
+                    self._lines_t[self._idx:self._idx + 1] = [('', '> ')]
+                    raise_signal(SIGWINCH)
                 for c in args[0]:
                     self.put_keypress(c)
                 self.put_keypress('KEY_ENTER')