fix: comprehensive tests, bug fixes, and Python 3.13 requirement#59
Closed
fix: comprehensive tests, bug fixes, and Python 3.13 requirement#59
Conversation
- Bump minimum Python requirement to >=3.13; update black target to py313 - Add .python-version pinned to 3.13.11 via pyenv - Create missing src/reqstool_python_decorators/decorators/__init__.py - Fix broken import paths in test resource files (src.reqstool_decorators → reqstool_python_decorators) - Fix import in test_processors.py (src.reqstool_python_decorators → reqstool_python_decorators) - Fix state accumulation bug: reset req_svc_results at start of process_decorated_data() - Fix fragile AST elementKind extraction: use node.__class__.__name__[:-3] instead of CPython repr parsing - Add test_decorators.py with 7 tests covering Requirements/SVCs decorators - Expand test_processors.py from 5 to 32 tests covering all previously untested methods
- Add Requirements section noting Python >= 3.13 - Fix broken decorator import path (reqstool-decorators → reqstool_python_decorators) - Fix broken processor import path (reqstool.processors → reqstool_python_decorators.processors)
decorators.py: - Use generic function syntax [T: Callable] (PEP 695) so type checkers preserve the decorated callable's type through Requirements/SVCs decorator_processor.py: - Add DecoratorInfo and ElementResult TypedDict classes with ReadOnly fields (PEP 705, typing.ReadOnly new in 3.13) to express that result dicts are built once and never mutated - Add `type Results = list[ElementResult]` type alias (PEP 695) - Annotate method signatures and internal variables with these types
decorator_processor.py: - Add FormattedEntry, RequirementAnnotations, FormattedData TypedDicts for format_results return type (replaces bare dict) - Add str | os.PathLike to all path/file parameters for consistency - Tighten format_results body to use typed local variables test_processors.py: - Standardise all tests on tmp_path (drop legacy tmpdir fixture) - Remove stray inline `import os` from test body; use pathlib Path.exists() - Remove unused tmpdir parameter from test_format_results_implementations
Member
Author
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
>=3.13(drop 3.10–3.12 support); updateblacktarget and add.python-versionmainand expand test coverage from ~5 to 32 testsBug fixes
src/reqstool_python_decorators/decorators/__init__.pytests/resources/test_decorators/*.pysrc.reqstool_decorators→reqstool_python_decorators)decorator_processor.pyreq_svc_results = []at start ofprocess_decorated_data()to prevent state accumulation across callsdecorator_processor.pystr(type(node)).split(".")[-1][:-5].upper()withnode.__class__.__name__[:-3].upper()Tests
tests/unit/reqstool_decorators/test_decorators.py— 7 tests forRequirementsandSVCsdecoratorstest_processors.py— 27 tests covering all previously untested methods (format_results,create_dir_from_path,process_decorated_data) plus edge cases forfind_python_filesandget_functions_and_classestest_get_functions_and_classes_element_kindexplicitly targets Fix 4 across all three node types (FUNCTION,ASYNCFUNCTION,CLASS)Documentation
README.md: add Requirements section (Python >= 3.13) and fix two broken import examples