Repository navigation
Commit c1ed962
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
174 | 176 | | |
175 | | - | |
| 177 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
824 | 824 | | |
825 | 825 | | |
826 | 826 | | |
827 | | - | |
828 | | - | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
829 | 831 | | |
830 | 832 | | |
831 | 833 | | |
| |||
847 | 849 | | |
848 | 850 | | |
849 | 851 | | |
850 | | - | |
851 | | - | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
852 | 856 | | |
853 | 857 | | |
854 | 858 | | |
| |||
870 | 874 | | |
871 | 875 | | |
872 | 876 | | |
873 | | - | |
874 | | - | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
875 | 881 | | |
876 | 882 | | |
877 | 883 | | |
| |||
946 | 952 | | |
947 | 953 | | |
948 | 954 | | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
949 | 958 | | |
950 | | - | |
951 | | - | |
| 959 | + | |
| 960 | + | |
952 | 961 | | |
953 | 962 | | |
954 | 963 | | |
955 | 964 | | |
956 | | - | |
957 | | - | |
| 965 | + | |
| 966 | + | |
958 | 967 | | |
959 | 968 | | |
960 | 969 | | |
| |||
0 commit comments