orchestrata_tools.test_generator.testgen
Reference › orchestrata_tools › test_generator › testgen
orchestrata_tools.test_generator.testgen — Layer 1 + 2 test generator.
The testgen package is the Layer 1 and 2 test generator. Layer 1 ranks functions by how much of the system they exercise. Layer 2 mechanically generates tests from structure and from branch conditions, aiming for runnable tests and not stubs. It works from the CodebaseAST and parsed trees of orchestrata_ast, and was restored in August 2026 after the earlier private parser tree was removed.
Parts, by role:
- Input bridge: adapter locates class and function nodes in the parsed trees and extracts extra structural facts.
- Selection: ranking scores functions by fan-in and reachability.
- Test writers: structural for dataclasses, enums, abstract classes and protocols; branch for branches and exceptions, with conditions deriving inputs.
- Support: types maps annotations to sample values, writer builds indented source, and config holds project settings.
- Orchestration: generator provides
generate_tests, and the package re-exports the public names.
Start with generator. The parent package is test_generator.
10 modules, 3,387 lines of code.
Modules
| Module | Summary | LOC |
|---|---|---|
__init__ |
orchestrata_tools.test_generator.testgen — Layer 1 + 2 test generator. | 70 |
adapter |
adapter.py — Bridges the CURRENT AST layer into the shapes the rest of testgen consumes. |
319 |
branch |
branch.py — Generate real, runnable branch/exception tests from AST structure. | 678 |
conditions |
conditions.py — Derives concrete input values from AST condition expressions. | 382 |
config |
config.py — Project-specific configuration for test generation. | 77 |
generator |
generator.py — Top-level orchestrator. | 355 |
ranking |
ranking.py — Identify the highest-priority functions to test first. | 176 |
structural |
structural.py — Layer 2 mechanical test generation. | 774 |
types |
types.py — Map annotation strings to usable sentinel values and pytest-parametrize entries. | 393 |
writer |
writer.py — Indented Python source builder. | 163 |