From: Christian Heller Date: Sat, 8 Nov 2025 00:54:16 +0000 (+0100) Subject: In verbose test log output, also show fragments section. X-Git-Url: https://plomlompom.com/repos/task?a=commitdiff_plain;h=c8ca00cdbdd0b6c38583a150c934a75bd7688c0d;p=ircplom In verbose test log output, also show fragments section. --- diff --git a/src/ircplom/testing.py b/src/ircplom/testing.py index 5296bfe..b21090a 100644 --- a/src/ircplom/testing.py +++ b/src/ircplom/testing.py @@ -30,6 +30,7 @@ _SEP_2 = ':' _TOK_IDX_REPEAT = 'r' _SIGNATURE_FOR_CMD = { + _MARK_FRAGMENT: (1, None), _MARK_INSERT: (5, 2), _MARK_LOG: (2, 0), _MARK_PROMPT: (1, None), @@ -294,6 +295,8 @@ class _Playbook: new_lines_t += [line_t] self._lines_t = new_lines_t if not replacement_happened: + for idx_info, line in self._lines_t[:fragments_cutoff + 1]: + self._line_log_and_parse(idx_info, line) self._lines_t = self._lines_t[fragments_cutoff + 1:] break @@ -312,7 +315,8 @@ class _Playbook: def _current_line(self) -> tuple[str, str]: return self._lines_t[self._idx] - def _log_columns(self, *items) -> None: + def _line_log_and_parse(self, idx_info: str, line: str + ) -> tuple[str, tuple[str, ...]]: col_titles = ('line number(s)', 'command', 'arguments') def args_verbose(args: tuple[str, ...]) -> str: @@ -331,8 +335,8 @@ class _Playbook: if not hasattr(self, '_colwidths'): self._colwidths: dict[str, int] = {} - for idx_str, line in self._lines_t: - cmd_name, args = self._cmdname_and_args_from(line) + for idx_str, line_ in self._lines_t: + cmd_name, args = self._cmdname_and_args_from(line_) for idx, value in enumerate((idx_str, cmd_name, args_verbose(args[:-1]))): @@ -344,8 +348,11 @@ class _Playbook: print_padded(to_pad=col_titles[:-1], unpadded_end=col_titles[-1]) + cmd_name, args = self._cmdname_and_args_from(line) + items = (idx_info, cmd_name) + args print_padded(to_pad=items[:2] + (args_verbose(items[2:-1]),), unpadded_end=items[-1]) + return cmd_name, args def ensure_has_started(self) -> None: 'Check if still at beginning, and if so, play till at next log line.' @@ -380,9 +387,7 @@ class _Playbook: if self._idx >= len(self._lines_t): self._lines_t += [('', '> /quit'), ('', 'log 0 <..')] - idx_info, line = self._current_line - cmd_name, args = self._cmdname_and_args_from(line) - self._log_columns(idx_info, cmd_name, *args) + cmd_name, args = self._line_log_and_parse(*self._current_line) if cmd_name == _MARK_PROMPT: assert self.put_keypress is not None for c in args[0]: