feat(discovery): transitive inheritance, inherited methods, and bare test support#94
Conversation
…test support Two-phase discovery pipeline: Phase 1 collects ClassInfo for all classes during AST parsing, Phase 2 resolves transitive inheritance and propagates inherited test methods across files using fixed-point iteration. - Transitive TestCase detection via class hierarchy walk - Inherited test methods injected into child classes (skips overrides) - Bare 'test' method name now matches alongside 'test_*' - Same-file class preferred for ambiguous base class resolution - 20 new unit tests + 4 integration tests Fixes #86 Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe changes implement transitive class inheritance resolution for test discovery. A new inheritance module is introduced with ClassInfo and resolution functions. TestModule now includes a class_defs field. The scanner extracts class metadata during module parsing, and discovery orchestrates cross-file inheritance resolution to uncover tests inherited through class hierarchies. Changes
Sequence DiagramsequenceDiagram
participant Scanner
participant ClassInfo Collection
participant Resolver
participant Apply
participant TestModule
Scanner->>ClassInfo Collection: Extract class metadata (bases, methods, markers, line_number)
ClassInfo Collection->>ClassInfo Collection: Accumulate ClassInfo across all modules
ClassInfo Collection->>Resolver: Pass all ClassInfo instances
Resolver->>Resolver: Phase 1: Propagate is_test_class via transitive inheritance
Resolver->>Resolver: Phase 2: Propagate inherited test methods through hierarchy
Resolver->>Apply: Return resolved ClassInfo with inherited methods
Apply->>TestModule: Inject resolved methods into each module's tests
Apply->>TestModule: Prune modules with no tests/fixtures/hooks
TestModule->>TestModule: Final discovery results ready
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested Labels
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
ClassInfofor all classes during AST parsing, Phase 2 resolves transitive inheritance and propagates inherited test methods via fixed-point iterationBaseLoader(TestCase)→CustomLoader(BaseLoader)now correctly discoveredStatReloaderTests(ReloaderTests)with empty body inherits all parent test methodstestmethod name matches alongsidetest_*(4 locations)Fixes #86
Summary by CodeRabbit