Create temporary YAML test files.
()
| 79 | |
| 80 | @pytest.fixture |
| 81 | def temp_yaml_files(): |
| 82 | """Create temporary YAML test files.""" |
| 83 | with tempfile.TemporaryDirectory() as tmpdir: |
| 84 | # Main workflow with config |
| 85 | main_yaml = os.path.join(tmpdir, "main_workflow.yaml") |
| 86 | with open(main_yaml, "w") as f: |
| 87 | f.write("""name: "test_main_workflow" |
| 88 | goal: "Test main workflow with config" |
| 89 | |
| 90 | config: |
| 91 | model: "gpt-4o" |
| 92 | max_tokens_per_step: 150000 |
| 93 | max_tool_calls_per_step: 15 |
| 94 | |
| 95 | parameters: |
| 96 | topic: "test topic" |
| 97 | |
| 98 | workflow: |
| 99 | - step: |
| 100 | name: "test_step" |
| 101 | instruction: "Do something" |
| 102 | """) |
| 103 | |
| 104 | # Submodule with custom config |
| 105 | submodule_with_config = os.path.join(tmpdir, "submodule_with_config.yaml") |
| 106 | with open(submodule_with_config, "w") as f: |
| 107 | f.write("""name: "submodule_with_custom_config" |
| 108 | goal: "Submodule that overrides parent config" |
| 109 | |
| 110 | config: |
| 111 | model: "gpt-4o-mini" |
| 112 | max_tokens_per_step: 50000 |
| 113 | |
| 114 | parameters: |
| 115 | input: "${INPUT}" |
| 116 | |
| 117 | workflow: |
| 118 | - step: |
| 119 | name: "sub_step" |
| 120 | instruction: "Process input" |
| 121 | """) |
| 122 | |
| 123 | # Submodule without config (inherits parent) |
| 124 | submodule_no_config = os.path.join(tmpdir, "submodule_no_config.yaml") |
| 125 | with open(submodule_no_config, "w") as f: |
| 126 | f.write("""name: "submodule_inherits_config" |
| 127 | goal: "Submodule that inherits parent config" |
| 128 | |
| 129 | parameters: |
| 130 | data: "${DATA}" |
| 131 | |
| 132 | workflow: |
| 133 | - step: |
| 134 | name: "inherit_step" |
| 135 | instruction: "Use parent config" |
| 136 | """) |
| 137 | |
| 138 | # YAML without config section |