def _extarct_only_robot(xmlfile):
"""remove from file not robot's elements
robot elements are: 'suite' 'statistics' 'errors'
"""
original_doc = ET.parse(xmlfile)
root = original_doc.getroot()
devices = root.find("devices")
if devices is not None:
root.remove(devices)
source = StringIO(ET.tostring(root))
ets = ETSource(source)
execution_result = ExecutionResultBuilder(ets).build(Result())
patched_file = File(BytesIO(force_bytes(source.getvalue())), name=xmlfile.name)
return (execution_result, patched_file)
评论列表
文章目录