Problem
The doctrine tests depend on infrastructure that has zero test coverage:
core/parsers/ast.py (559 lines) — AST/griffe-based class extraction
core/infrastructure/repositories/introspection/bounded_context.py (285 lines) — filesystem BC discovery
core/use_cases/generic_crud.py (106 lines) — CRUD base classes for downstream projects
If any of these have a bug, doctrine tests produce false negatives (violations
pass silently). The parser in particular is the foundation — every doctrine test
routes through it.
Proposal
Add three test files, all pure additions with no changes to existing code:
core/parsers/tests/test_ast.py
parse_python_classes() — finds classes in a directory of .py files
parse_python_classes_from_file() — single-file extraction
- Class extraction: names, bases, fields, methods, docstrings
_imported_class_names() — detects re-exported Request/Response classes
parse_module_docstring() — extracts module-level docstrings
- Edge cases: empty files, syntax errors, non-existent paths,
_-prefixed files
parse_pipelines_from_file() — pipeline class detection with decorator/method checks
core/infrastructure/repositories/introspection/tests/test_bounded_context.py
- Discovers BCs with
entities/ or use_cases/ directories
- Skips reserved words, dot-prefixed, non-packages
- Handles nested solutions (contrib/ containing BCs)
- Detects structural markers correctly
- Caching and cache invalidation
get() by slug
core/use_cases/tests/test_generic_crud.py
GetUseCase._get_by_id() — returns entity, raises EntityNotFoundError
ListUseCase._list_all() — delegates to repo
CreateUseCase._create() — generates ID, builds entity, saves
UpdateUseCase._update_by_id() — fetches, applies model_copy, saves
All tests use tmp_path fixtures and in-memory fakes. No changes to
production code required.
Problem
The doctrine tests depend on infrastructure that has zero test coverage:
core/parsers/ast.py(559 lines) — AST/griffe-based class extractioncore/infrastructure/repositories/introspection/bounded_context.py(285 lines) — filesystem BC discoverycore/use_cases/generic_crud.py(106 lines) — CRUD base classes for downstream projectsIf any of these have a bug, doctrine tests produce false negatives (violations
pass silently). The parser in particular is the foundation — every doctrine test
routes through it.
Proposal
Add three test files, all pure additions with no changes to existing code:
core/parsers/tests/test_ast.pyparse_python_classes()— finds classes in a directory of.pyfilesparse_python_classes_from_file()— single-file extraction_imported_class_names()— detects re-exported Request/Response classesparse_module_docstring()— extracts module-level docstrings_-prefixed filesparse_pipelines_from_file()— pipeline class detection with decorator/method checkscore/infrastructure/repositories/introspection/tests/test_bounded_context.pyentities/oruse_cases/directoriesget()by slugcore/use_cases/tests/test_generic_crud.pyGetUseCase._get_by_id()— returns entity, raisesEntityNotFoundErrorListUseCase._list_all()— delegates to repoCreateUseCase._create()— generates ID, builds entity, savesUpdateUseCase._update_by_id()— fetches, applies model_copy, savesAll tests use
tmp_pathfixtures and in-memory fakes. No changes toproduction code required.