Create a temporary YAML config file.
(temp_dir)
| 115 | |
| 116 | @pytest.fixture |
| 117 | def temp_yaml_file(temp_dir): |
| 118 | """Create a temporary YAML config file.""" |
| 119 | import yaml |
| 120 | |
| 121 | filepath = os.path.join(temp_dir, "test_config.yaml") |
| 122 | config = { |
| 123 | "datasets": [ |
| 124 | {"file_path": "data1.json", "source": "TestSource1"}, |
| 125 | {"file_path": "data2.json", "source": "TestSource2"}, |
| 126 | ] |
| 127 | } |
| 128 | with open(filepath, "w", encoding="utf-8") as f: |
| 129 | yaml.dump(config, f) |
| 130 | return filepath |
| 131 | |
| 132 | |
| 133 | # ============================================================================= |