Closed
Conversation
Add 9 comprehensive tests to reach 100% coverage for: - cancelable.py (99.80% -> all targeted lines covered) - composite.py (76.87% -> 100%) - decorators.py (99% -> 100%) New tests cover: - Parent token linking warnings (line 810) - Combined cancelable linking warnings (line 828) - BaseException handling (branch 723→734) - MonitoredSource exception handling (lines 71-75, 250-254) - Attribute delegation via __getattr__ (lines 79, 258) - Multiple trigger calls (branch 48→54) - Existing cancelable config handling (line 157) All 452 tests passing. 15 files now have 100% coverage.
BREAKING CHANGE: Drop Python 3.12 support, require Python 3.13+ ## Python Version Updates - Update requires-python to >=3.13 in pyproject.toml - Update Python version classifiers (remove 3.12, keep 3.13, 3.14) - Update Ruff target-version to py313 - Update Basedpyright pythonVersion to 3.13 - Update all workflow matrices to test Python 3.13 and 3.14 - Update README.md badges and description ## CI Workflow Fixes - Add conditional guards to prevent duplicate runs: - validate job: runs only on 'pull_request' event - validate-docs job: runs only on 'pull_request' event - check-pr-title job: runs only on 'pull_request_target' event - Remove problematic 'uvx hatch version dev' step from docs build (MkDocs doesn't require version to be set) ## Type Annotation Fixes - Add type annotations to test fixture parameters in: - tests/unit/test_threading_bridge.py - tests/unit/test_thread_cancelation.py - Add missing imports for AnyioBridge and OperationRegistry - Add return type annotations (-> None) to all test methods Resolves duplicate workflow runs issue where both pull_request and pull_request_target events were triggering validation jobs. All tests passing (26 tests in affected files).
- Use 'standard' mode for tests instead of 'strict' - Use 'basic' mode for examples (demo code) - Keep 'strict' mode for production code in src/ - Fix forward reference for Cancelable in types.py - Remove examples from strict type checking This reduces type checking errors from 2108 to ~1649 by applying appropriate type checking levels to different parts of the codebase. Tests and examples don't need production-level type strictness.
- Add type annotations to result/error lists in thread communication patterns - Fix result: list[Cancelable | None] = [None] in test_registry.py (6 locations) - Fix result/error patterns in test_threading_bridge.py (7 locations) - Add type annotations to 4 callback functions in test_cancelable.py - Add required imports: Any, OperationContext - All thread_func definitions now have -> None return type This is Fix Group 1 from the Moderate Cleanup plan. Reduces type errors from 1601 to 1591 (10 errors fixed). All 43 tests in modified files pass.
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
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.
Summary
composite.py(was 76.87%)decorators.py(was ~99%)cancelable.pyto 99.80% (all originally targeted lines now covered)Coverage Improvements
composite.py (100% ✓)
_MonitoredSource.stop_monitoring()__getattr___AllOfMonitoredSource.stop_monitoring()decorators.py (100% ✓)
cancelable.py (99.80%)
Tests Added
test_cancelable.py (3 tests):
test_parent_token_not_linkable_warningtest_combined_cancelables_not_linkable_warningtest_base_exception_not_exception_typetest_composite.py (5 tests):
test_monitored_source_stop_monitoring_exceptiontest_monitored_source_attribute_delegationtest_monitored_source_multiple_triggerstest_all_of_monitored_source_stop_monitoring_exceptiontest_all_of_monitored_source_attribute_delegationtest_decorators.py (1 test):
test_create_cancelable_from_config_existing_cancelableTest Plan