Code review comment for lp:~milo/linaro-image-tools/fix-tests

Revision history for this message
James Tunnicliffe (dooferlad) wrote :

226 @@ -132,8 +133,9 @@
227 :return The configuration read from the file as a dictionary.
228 """
229 try:
230 - config = yaml.safe_load(hwpack)
231 - self._set_attributes(config)
232 + with open(hwpack, 'r') as hw:
233 + config = yaml.safe_load(hw)
234 + self._set_attributes(config)
235 return config
236 except yaml.YAMLError, ex:
237 logger.debug("Error loading YAML file %s" % hwpack, ex)

I believe that since we are opening a file inside the with statement, we also need to catch the IOError exception for when the file doesn't exist. Other than that, looks good.

« Back to merge proposal