Commit f04a7f2d authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

python unittest: use context to open files

fix:
…/pinocchio/unittest/python/bindings_urdf.py:23: ResourceWarning: unclosed file <_io.TextIOWrapper name='…/pinocchio/models/others/robots/romeo_description/urdf/romeo.urdf' mode='r' encoding='UTF-8'>
  file_content = open(self.model_path,"r").read()
parent 1b10650f
Pipeline #11656 passed with stage
in 235 minutes and 55 seconds
......@@ -20,8 +20,9 @@ class TestGeometryObjectUrdfBindings(unittest.TestCase):
model_ref = pin.buildModelFromUrdf(self.model_path, pin.JointModelFreeFlyer())
def test_xml(self):
file_content = open(self.model_path,"r").read()
with open(self.model_path) as model:
file_content = model.read()
model_ref = pin.buildModelFromUrdf(self.model_path, pin.JointModelFreeFlyer())
model = pin.buildModelFromXML(file_content,pin.JointModelFreeFlyer())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment