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

Revision history for this message
Milo Casagrande (milo) wrote :

On Thu, Jan 3, 2013 at 12:24 PM, James Tunnicliffe
<email address hidden> 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.

We are actually checking this in linaro-android-media-create, making
sure the arg passed is a real file and it exists, otherwise exit
immediately.

--
Milo Casagrande
Infrastructure Engineer
Linaro.org <www.linaro.org> │ Open source software for ARM SoCs

« Back to merge proposal