Load response when loading iteration

This commit is contained in:
2025-04-20 12:31:55 +02:00
parent 7a4028085f
commit def822d61f
2 changed files with 11 additions and 5 deletions

View File

@@ -28,14 +28,18 @@ class IterationParser:
"""
root = ET.fromstring(content)
context_elem = root.find("context")
response_elem = root.find("response")
if context_elem is None:
raise ValueError("Invalid iteration file - missing context")
context = ET.fromstring(context_elem.text)
if response_elem is None:
raise ValueError("Invalid iteration file - missing response")
context = context_elem.text.strip()
response = response_elem.text.strip()
entries = []
for elem in context:
for elem in ET.fromstring(context):
if elem.tag == "background":
entries.append(IterationParser._parse_background(elem, work_dir))
elif elem.tag == "parse_error":
@@ -51,7 +55,7 @@ class IterationParser:
elif elem.tag == "write_stdout":
entries.append(IterationParser._parse_write(elem, io_buffer))
return entries
return (context, response, entries)
@staticmethod
def _parse_background(elem: ET.Element, work_dir: Path) -> BackgroundEntry: