Skip to content

fix: comprehensive tests, bug fixes, and Python 3.13 requirement#59

Closed
jimisola wants to merge 5 commits intomainfrom
fix/main-branch-bugs
Closed

fix: comprehensive tests, bug fixes, and Python 3.13 requirement#59
jimisola wants to merge 5 commits intomainfrom
fix/main-branch-bugs

Conversation

@jimisola
Copy link
Member

Summary

  • Bump minimum Python requirement to >=3.13 (drop 3.10–3.12 support); update black target and add .python-version
  • Fix 4 bugs found in main and expand test coverage from ~5 to 32 tests

Bug fixes

# File Fix
1 src/reqstool_python_decorators/decorators/__init__.py Create missing package marker
2 tests/resources/test_decorators/*.py Correct broken import paths (src.reqstool_decoratorsreqstool_python_decorators)
3 decorator_processor.py Reset req_svc_results = [] at start of process_decorated_data() to prevent state accumulation across calls
4 decorator_processor.py Replace CPython repr-dependent str(type(node)).split(".")[-1][:-5].upper() with node.__class__.__name__[:-3].upper()

Tests

  • New tests/unit/reqstool_decorators/test_decorators.py — 7 tests for Requirements and SVCs decorators
  • Expanded test_processors.py — 27 tests covering all previously untested methods (format_results, create_dir_from_path, process_decorated_data) plus edge cases for find_python_files and get_functions_and_classes
  • Parametrized test_get_functions_and_classes_element_kind explicitly targets Fix 4 across all three node types (FUNCTION, ASYNCFUNCTION, CLASS)
  • All 32 tests pass

Documentation

  • README.md: add Requirements section (Python >= 3.13) and fix two broken import examples

- 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
@jimisola
Copy link
Member Author

Superseded by #60 (fix) and #61 (feat) — split for cleaner changelog entries.

@jimisola jimisola closed this Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant