tests(refactor[plugin_system]) Use Pane.display_message wrapper · tmux-python/tmuxp@c1ed962 · GitHub
Skip to content

Commit c1ed962

Browse files
committed
tests(refactor[plugin_system]) Use Pane.display_message wrapper
why: Six tests in the plugin-system suite were querying tmux for session/window names via the same `session.cmd("display-message", "-p", "'#S'")` escape hatch that production just migrated away from in `cli/load.py:_reattach`. Keeping the tests on the typed wrapper that production now uses keeps the call shape consistent across the codebase and removes the last `cmd("display-message", ...)` site from the repo. what: - `tests/cli/test_cli.py::test_reattach_plugins`: replace the `cmd()` call with `active_pane.display_message("'#S'", get_text=True)` so the post-reattach assertion uses the typed wrapper. - `tests/workspace/test_builder.py`: migrate four `test_plugin_system_*` checks (`before_workspace_builder`, `on_window_create`, `after_window_finished`, and the multi-window variant covering both `before_script` and `after_window_finished`) onto `active_pane.display_message()`. The multi-window variant hoists the active_pane lookup once and reuses it for both the `'#S'` and `'#W'` queries. - Each call site adds a narrowing assert on `active_pane` (libtmux types it as `Pane | None`) so mypy can prove the call is well-typed. Mirrors the production assert added in `_reattach()`. No behavior change: tmux's `display-message` defaults to the session's active pane when no `-t` is passed, so the underlying tmux invocations are byte-for-byte identical to the prior `session.cmd(...)` calls.
1 parent 32f62cf commit c1ed962

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

‎tests/cli/test_cli.py‎

Lines changed: 4 additions & 2 deletions

‎tests/workspace/test_builder.py‎

Lines changed: 19 additions & 10 deletions

0 commit comments

Comments
 (0)