Skip to content

Commit e3a5ba1

Browse files
committed
tests(test_hooks[run_hook]): Add test for run_hook() method
why: Improve code coverage for hooks.py run_hook method. what: - Add test_run_hook_basic to verify run_hook() executes without error - Test verifies method returns self for chaining
1 parent d491d45 commit e3a5ba1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test_hooks.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,3 +773,28 @@ def test_show_hooks_stores_string_values(
773773

774774
# Cleanup
775775
session.unset_hook(test_case.hook.split("[")[0])
776+
777+
778+
# =============================================================================
779+
# run_hook Tests
780+
# =============================================================================
781+
782+
783+
def test_run_hook_basic(server: Server) -> None:
784+
"""Test run_hook() method exists and can be called without error."""
785+
if not has_gte_version("3.2"):
786+
pytest.skip("Requires tmux >= 3.2")
787+
788+
session = server.new_session(session_name="test_run_hook")
789+
790+
# Set a hook first
791+
session.set_hook("session-renamed[0]", 'display-message "test"')
792+
793+
# Run the hook immediately - should not raise
794+
result = session.run_hook("session-renamed[0]")
795+
796+
# Verify returns self for chaining
797+
assert result is session
798+
799+
# Cleanup
800+
session.unset_hook("session-renamed")

0 commit comments

Comments
 (0)