-
Notifications
You must be signed in to change notification settings - Fork 112
Waiter 0.1 #594
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
16
commits into
master
Choose a base branch
from
waiter-0.1
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
Waiter 0.1 #594
Conversation
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
This comment was marked as outdated.
This comment was marked as outdated.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #594 +/- ##
==========================================
+ Coverage 46.21% 55.49% +9.27%
==========================================
Files 19 34 +15
Lines 1876 2386 +510
Branches 294 367 +73
==========================================
+ Hits 867 1324 +457
- Misses 894 925 +31
- Partials 115 137 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merged
Closed
…essaging - Add descriptive timeout message to WaitTimeout exception - Ensure consistent handling of timeout errors - Fix type hints for function return values
…I and multi-pattern support - Implement Playwright-inspired fluent API for more expressive test code - Add wait_for_any_content and wait_for_all_content for composable waiting - Fix type annotations for all wait_for functions - Improve WaitResult class to handle different return types - Fix doctest examples to prevent execution failures - Enhance error handling with better timeout messages
- Fix test_wait_for_pane_content_exact to use correct match type - Update test_wait_for_any_content to check matched_pattern_index - Fix test_wait_for_all_content to handle list of matched patterns - Add comprehensive type annotations to all test functions - Ensure proper handling of None checks for Pane objects
…iters - Create detailed markdown documentation in docs/test-helpers/waiter.md - Add key features section highlighting main capabilities - Include quick start examples for all functions - Document fluent API with Playwright-inspired design - Explain wait_for_any_content and wait_for_all_content with practical examples - Add detailed API reference for all waiters - Include testing best practices section
- Adds a conftest.py file in tests/examples to register the pytest.mark.example marker - Eliminates pytest warnings about unknown markers in example tests - Improves test output by removing noise from warnings
- Each test file focuses on a single feature or concept of the waiter module - Added descriptive docstrings to all test functions for better documentation - Created conftest.py with session fixture for waiter examples - Added helpers.py with utility functions for the test examples - Test files now follow a consistent naming convention for easier reference - Each test file is self-contained and demonstrates a single concept - All tests are marked with @pytest.mark.example for filtering This restructuring supports the documentation update to use literalinclude directives, making the documentation more maintainable and ensuring it stays in sync with actual code.
Fixes test_wait_for_pane_content_exact_match_detailed failure on tmux 3.1b where capture_pane() was called immediately after send_keys() before the content had been flushed/rendered by tmux. The race condition manifested as: AssertionError: assert 'UNIQUE_TEST_STRING_123' in '' Adding a 0.1s delay after send_keys() allows tmux to flush the content before capture_pane() is called, fixing the timing issue on older versions.
why: test_wait_for_any_content_exact_match was flaky due to race
condition - pane content captured before terminal finished redrawing
after clear command.
what:
- Add wait_until_pane_ready() after send_keys("clear") to ensure
shell prompt is ready before capturing content
- Uses idiomatic waiter pattern instead of arbitrary time.sleep()
why: Test was unreliable because shell prompts vary by environment what: - Replace prompt detection ($, %, >, #) with echo marker pattern - Remove skip decorator - test now runs reliably - Simplify test logic by using deterministic output
why: Module had no direct tests, only indirect coverage via waiter mocking what: - Test immediate success (returns True on first call) - Test success after multiple retries - Test timeout with raises=True (raises WaitTimeout) - Test timeout with raises=False (returns False, WaitTimeout)
why: test_wait_for_pane_content_exact_match_detailed is flaky on tmux 3.4 due to capture-pane line wrapping behavior differences introduced in that version (commit 9cc8e40a added GRID_STRING_EMPTY_CELLS flag) what: - Add pytest.mark.skipif to skip test on tmux 3.4 specifically - Import has_version for exact version checking
why: Sphinx autodoc failed with ModuleNotFoundError what: - Change libtmux.test.retry_extended to libtmux._internal.retry_extended
tony
added a commit
that referenced
this pull request
Nov 28, 2025
Add deprecation warning (`FutureWarning`) for tmux versions below 3.2a, introduce `TMUX_SOFT_MIN_VERSION` constant for deprecation threshold, and prepare for future hard minimum version bump. Motivation: tmux 3.2a was released in April 2021 and is the version shipped with Ubuntu 22.04 LTS. Older versions (3.1 and below) are only found on EOL platforms like Ubuntu 20.04. Deprecating these versions allows libtmux to: - Remove legacy compatibility code in future releases - Take advantage of newer tmux features (e.g., `format-defaults`, extended hooks, `display-menu` APIs) - Align supported versions with actively maintained distributions Changes: Source (`src/libtmux/common.py`): - `TMUX_SOFT_MIN_VERSION`: New constant set to `"3.2a"` - `_version_deprecation_checked`: Module-level flag ensuring warning fires only once per process - `_check_deprecated_version()`: New helper that emits `FutureWarning` when tmux version is below 3.2a - `get_version()`: Now calls `_check_deprecated_version()` to trigger warning on first version check Environment Variable: - Users can suppress warning via `LIBTMUX_SUPPRESS_VERSION_WARNING=1` Tests (`tests/test_common.py`): - `test_version_deprecation_warning` - 5 parametrized cases covering deprecated versions, current versions, and env var suppression - `test_version_deprecation_warns_once` - Verifies warning fires once - `test_version_deprecation_via_get_version` - Integration test verifying warning through full `get_version()` call chain Documentation: - `docs/quickstart.md`: Updated Requirements with version recommendations - `CHANGES`: Added Deprecations and Internal sections for 0.48.x Future Work: In a future release (e.g., 0.49.0 or 0.50.0): - Bump `TMUX_MIN_VERSION` from `"1.8"` to `"3.2a"` - Remove `_check_deprecated_version()` helper and `TMUX_SOFT_MIN_VERSION` - Remove tests that mock old version values See Also: #516, #594, #603, #604
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Extracted from before v0.46.1 / #582
Enhanced Terminal Content Waiting Utility
Overview
This PR introduces a significant enhancement to the terminal content waiting utility in libtmux. The changes include a more fluent API inspired by Playwright, improved error handling, type checking fixes, and the ability to wait for multiple content patterns.
Key Features
1. Fluent API with Playwright-Inspired Design
2. Multiple Pattern Support
3. Mixed Pattern Types
4. Performance and Debugging Improvements
wait_for_all_contentto return a list of matched patternsFixed Issues
matched_lineandmatch_lineattributesDocumentation
docs/test-helpers/waiter.mdWaitResultobject propertiesExample Code
tests/examples/test/test_waiter.pydemonstrating different ways to use the enhanced APIType Checking
Testing
wait_for_any_contentandwait_for_all_contentRecent Improvements
CI Compatibility
Documentation