-
Notifications
You must be signed in to change notification settings - Fork 110
Improved option management, add hook management #516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tony
wants to merge
65
commits into
master
Choose a base branch
from
improved-options
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
2d40e6c
docs(test-helpers) Update to existing modules
tony e8b5d7a
docs(test-helpers) Add retry page
tony 76326f3
py(deps[dev]) Bump dev packages
tony 1668b45
chore: Add `__init__.py` for tests/examples
tony fc3dec2
chore: Add `__init__.py` for tests/examples/test
tony a438f2d
chore: Add `__init__.py` for tests/examples/_internal/waiter
tony aa260f2
fix(retry): Improve retry_until_extended function with better error m…
tony 10a37e5
feat(waiter): Enhance terminal content waiting utility with fluent AP…
tony 0c74d33
test(waiter): Fix test cases and improve type safety
tony a10493a
docs(waiter): Add comprehensive documentation for terminal content wa…
tony 6bdbb5c
pyproject(mypy[exceptions]): examples to ignore `no-untyped-def`
tony d436d75
test: add conftest.py to register example marker
tony 17d2967
refactor(tests[waiter]): Add waiter test examples into individual files
tony 50081b5
docs(CHANGES) Note `Waiter`
tony db47652
feat(waiter): Add terminal content waiting utility for testing (#582)
tony 9661039
cursor(rules[git-commits]) Use component name first
tony 677aa96
cursor(rules[git-commits]) Standardize further
tony 60d1386
cursor(rules[dev-loop]) Use `--show-fixes` in `ruff check`
tony b5b4a8c
feat!(Window): Set option flags
tony 84bfbc1
refactor!(Window): Deprecate set_window_option -> set_option
tony 5cf3321
tests(Window): Rename test for show_window_options()
tony 4a314ce
tests(Window): set_option
tony 1e00ae6
Window: Add show_option(), deprecate show_window_option()
tony 4596b56
chore(Window): {set,show}-window-option -> {set,show}-option -w
tony 486cdce
libtmux.constants: Add OptionScope and OPTION_SCOPE_FLAG_MAP
tony 7e9a6e6
feat(Window): scope param for Window.{set,show}_option
tony ae6da1c
tests(Window): show_options w/ scope
tony c5aa606
tests: show_window_option() -> show_option()
tony 16a1396
feat(common): Add CmdMixin, CmdProtocol
tony 7c11e71
refactor!(options): Move handle_options_error -> options
tony 40b529c
feat(internal[sparse_array]): Add SparseArray
tony df0656f
feat(options): Add OptionsMixin
tony 77ca697
feat(Window): Use OptionsMixin for Window.set_option, Window.show_opt…
tony 7cd87f2
feat(Pane): Use OptionsMixin for Pane.set_option, Pane.show_option(s)
tony c34a6b4
feat(Session): Use OptionsMixin for Session.set_option, Session.show_…
tony f2bc27a
feat(Server): Use OptionsMixin for Server.set_option, Server.show_opt…
tony 9b9c399
tests: Handle Window.show_options scope mismatch
tony 3fd8319
tests(window): Version guard to scope
tony 9696b16
tests(Window): For Window.default_option_scope
tony 3360993
docs(options): Add page for option helpers
tony f92a835
internal(constants[options]): GPT generated dataclasses
tony 2d9e2b7
tests(test_options): Test OptionsMixin
tony f96093b
docs(CHANGES): Note updates for options
tony 1756f9c
constants: Add HOOK_SCOPE_FLAG_MAP
tony e62484d
docs(API): Document internal constants
tony ce8fbac
feat(internal[constants]): Add Hooks data structure
tony a03f1cc
feat!(hooks): HooksMixin
tony 39b5caa
feat(Pane): Add HooksMixin
tony 0ccc4f4
feat(Window): Add HooksMixin
tony 873f29d
feat(Session): Add HooksMixin
tony 9773e84
feat(Server): Add HooksMixin
tony 5f80216
docs(API): Add Hooks
tony 68a09bd
tests(test_hooks): Test HooksMixin
tony 7c92836
!squash tests(test_options): Tests for OptionsMixin
tony dee251c
!squash test_options: renamings
tony bc3b759
!squash tmux set options. I want to be able to pass in high-level, "…
tony e855ff7
Revert "!squash tmux set options. I want to be able to pass in high-…
tony efe6884
!squash test_options: Stable baseline
tony fa47cdb
!squash to feat(Window): scope param for Window.{set,show}_option
tony 66abda8
fix(options): improve type safety for SparseArray handling
tony 73dd13c
test(options): update terminal-features test for tmux 3.4
tony 57383bf
test(options): improve test coverage and type safety
tony 1616798
fix(tests): improve type safety in style option tests
tony d78af39
fix(tests): handle status-format version compatibility
tony 7bff126
fix(tests): handle update-environment version compatibility
tony File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
!squash test_options: Stable baseline
- Loading branch information
commit efe6884b41df73c9efaae711fa51aa5d1b6995ee
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -454,3 +454,56 @@ def test_show_option_pane_fixture( | |
assert k in result | ||
|
||
assert result[k] == v | ||
|
||
|
||
def test_stable_baseline_options_and_hooks(server: Server) -> None: | ||
"""Ensure stable baseline across tmux versions.""" | ||
session = server.new_session(session_name="test", detach=True) | ||
|
||
# List variables | ||
assert server.show_option("command-alias") == { | ||
"choose-session": "choose-tree -s", | ||
"choose-window": "choose-tree -w", | ||
"info": "show-messages -JT", | ||
"server-info": "show-messages -JT", | ||
"split-pane": "split-window", | ||
"splitp": "split-window", | ||
} | ||
Comment on lines
+464
to
+471
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (testing): Test edge cases and error conditions The tests should cover edge cases such as empty values, invalid option names, and other error conditions to ensure that the option management functionality is robust. Suggested implementation: def test_stable_baseline_options_and_hooks(server: Server) -> None:
"""Ensure stable baseline across tmux versions and handle edge cases.""" session = server.new_session(session_name="test", detach=True)
# Test invalid option name
with pytest.raises(TmuxCommandError):
server.show_option("non-existent-option")
# Test empty option value (setting and getting)
server.set_option("status-left", "")
assert server.show_option("status-left") == ""
# List variables You'll need to:
|
||
if has_gte_version("3.2"): | ||
assert server.show_option("terminal-features") == { | ||
"screen*": [ | ||
"title", | ||
], | ||
"xterm*": [ | ||
"clipboard", | ||
"ccolour", | ||
"cstyle", | ||
"focus", | ||
"title", | ||
], | ||
} | ||
assert server.show_option("terminal-overrides") is None | ||
assert server.show_option("user-keys") is None | ||
assert server.show_option("status-format") is None | ||
assert server.show_option("update-environment") is None | ||
|
||
# List variables: Pane | ||
pane = session.active_pane | ||
assert pane is not None | ||
assert pane.show_option("pane-colours") is None | ||
|
||
|
||
def test_high_level_api_expectations(server: Server) -> None: | ||
"""Ensure options and hooks behave as expected.""" | ||
|
||
# Raw input and output | ||
# Should be able to functionally parse raw CLI output, even outside of libtmux into | ||
# options. | ||
|
||
# Parsing steps | ||
# 1. Basic KV split: Should split options into key,values. | ||
# 2. Structure: Should decompose array-like options and dictionaries | ||
# In the case of sparse arrays, which don't exist in Python, a SparseArray is | ||
# used that behaves like a list but allows for sparse indexes so the indices | ||
# aren't lost but the shape is still respected. | ||
# 3. Python Typings: Should cast the fully structured objects into types |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Consider adding tests for hooks with different scopes
The test suite should include test cases that verify hook behavior with different scopes (server, session, window, pane) to ensure that hooks are working as expected in all contexts.
Suggested implementation:
You may need to: