orchestrata_tools.test_generator
Reference › orchestrata_tools › test_generator
Test generation: stubs, interface tests, branch coverage — now with enhanced @traces support.
The test_generator package generates pytest code from AST metadata. It is used by the scripts scripts.gen_tests and scripts.test-gen. There are two generations of generator side by side.
- Signature and docstring generators, working from
MethodInfoandClassInfo: stub_generator writes stubs, interface_tests tests protocols and abstract classes, branch_tests and behavioral_tests read the docstring, and combined_generator combines all four. - Whole-module generators: enhanced_generator and jinja_gen produce complete test modules with
@tracespropagation; the second renders with Jinja2 templates and finds branch points in the source. - testgen is the Layer 1 and 2 generator that works from the full
CodebaseASTfrom orchestrata_ast and its parsed trees, and writes runnable branch and structural tests.
Generators share the parameter value strategies in testgen.types. Gaps to fill come from test_analyzer. Start with combined_generator for the simple path and testgen generator for the full pipeline.
18 modules, 4,909 lines of code.
Subpackages
| Package | Modules | LOC |
|---|---|---|
testgen |
10 | 3,387 |
Modules
| Module | Summary | LOC |
|---|---|---|
__init__ |
Test generation: stubs, interface tests, branch coverage — now with enhanced @traces support. | 27 |
behavioral_tests |
Generate behavioral tests from docstring Raises/Returns/Args clauses. | 106 |
branch_tests |
Analyze method docstrings to identify branches and generate test cases. | 115 |
combined_generator |
Unified test generation combining all strategies. | 90 |
enhanced_generator |
Enhanced test generator — produces spec-compliant pytest stubs with @traces, async support, fixtures, and AAA pattern. | 352 |
interface_tests |
Generate tests for Protocol and ABC classes. | 118 |
jinja_gen |
Jinja2-powered test generator — deterministic, configurable, template-driven. | 586 |
stub_generator |
Generate pytest test stubs from method signatures. | 128 |