We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc30efd commit b04a762Copy full SHA for b04a762
1 file changed
tests/base.py
@@ -99,10 +99,11 @@ def load(self, name):
99
100
def load_xml(self, name, xpath=None):
101
"""returns xml.etree"""
102
- root = etree.parse(self.path(name)).getroot()
103
- if xpath is None:
104
- return root
105
- return root.find(xpath)
+ with open(self.path(name)) as f:
+ root = etree.parse(f).getroot()
+ if xpath is None:
+ return root
106
+ return root.find(xpath)
107
108
def dump(self, root):
109
print(etree.tostring(root))
0 commit comments