tony · GitHub

@tony

why: Ensure test utilities for random string generation and naming work correctly
what:
- Add tests for RandomStrSequence with default and custom characters
- Test iterator protocol and uniqueness guarantees
- Test session/window name generation with real tmux server
- Use string.ascii_uppercase for predictable character set
- Verify prefix requirements and name collisions
refs: Uses global server/session fixtures for real tmux testing
why: Ensure temporary tmux objects are properly created and cleaned up
what:
- Test session creation and automatic cleanup
- Verify custom session names are respected
- Test window creation and automatic cleanup
- Ensure cleanup happens even during exceptions
- Verify window counts and IDs before/after operations
refs: Uses global server/session fixtures for real tmux testing
why: Ensure test utilities handle name collisions correctly
what:
- Fix mocking of RandomStrSequence.__next__
- Add doctest examples coverage
- Test name collision handling in both session and window names
refs: Coverage improved from 52% to 58%
why: Ensure test constants are correctly defined and configurable
what:
- Test default values for retry timeouts
- Test environment variable configuration
- Test session prefix constant
refs: Coverage for constants.py now at 100%
- Add new test file for environment variable management
- Test setting and unsetting environment variables
- Test context manager functionality
- Test cleanup on normal exit and exceptions
- Improve EnvironmentVarGuard to properly handle unset variables
- Ensure variables are restored to original state
- Add test for default character set
- Add test for custom character sets
- Add test for string uniqueness
- Add test for iterator protocol
- Add test for doctest examples
- Improve test coverage and maintainability
- Add realistic sleep durations to simulate work
- Add timing assertions with reasonable tolerances
- Test both success and timeout scenarios
- Test behavior with raises=False option
- Improve test readability with clear timing expectations
- Remove duplicate logger definition
- Add proper Self type hint for Python 3.11+
- Clean up redundant type checking imports
- Improve code organization
- Add test for logger configuration
- Add tests for multiple collisions in name generation
- Add test for Self type annotation (Python 3.11+)
- Add test for global namer instance
- Add doctest example coverage
- Use a single with statement with multiple contexts
- Fix SIM117 ruff linting issue
- Add pragma: no cover to type checking imports
- Add pragma: no cover to future annotations
- Add pragma: no cover to Self type imports
- Add pragma: no cover to doctest examples
- Fix Self type imports for Python 3.11+
- Improve coverage reporting accuracy
- Add test for unsetting previously set variables
- Add test for __exit__ with exception parameters
- Fix line length issues in random.py
- Fix Self type imports in random.py
- Remove unused pytest import from test_environment.py
why: The doctest examples were using line continuation with backslash followed by ellipsis which caused syntax errors during doctest execution.
what: Replace multiline examples with simpler single-line assertions and use intermediate variables to make the examples more readable
- Add test_random_str_sequence_small_character_set to verify behavior with exactly 8 characters
- Add test_random_str_sequence_insufficient_characters to verify proper error handling
- Add test_logger_configured to verify logger configuration using caplog fixture
- Improve assertion messages for better test diagnostics
- Use pytest.LogCaptureFixture for proper logger testing
- Add test_temp_session_outside_context to test handling of manually killed sessions
- Add test_temp_window_outside_context to verify cleanup behavior for windows
- Improve comments and assertions for better test clarity
- Fix formatting and line length issues
test: remove mocked session test in favor of real implementation
…thods
why: Ensure test utilities are properly tested and typed
what: - Add proper type annotations for monkeypatch in test functions - Improve test coverage for RandomStrSequence iterator protocol - Add tests for collision handling with actual tmux objects - Add tests for import coverage and return statements - Fix formatting to comply with linting rules

@tony

@tony

tony marked this pull request as ready for review

February 25, 2025 22:07

sourcery-ai[bot]

@tony

@tony

tony deleted the test-helpers-coverage branch

February 25, 2025 22:12

tony added a commit that referenced this pull request

Feb 25, 2025

Read the original on github.com ↗