Merge "Close files after use"

This commit is contained in:
Jenkins 2014-09-25 15:43:08 +00:00 committed by Gerrit Code Review
commit 629ef2d69d
3 changed files with 6 additions and 3 deletions

View File

@ -37,7 +37,8 @@ class DoxYaml(object):
def _open_dox_yaml(self):
if self._yaml is None:
self._yaml = yaml.load(open('dox.yml', 'r'))
with open('dox.yml', 'r') as f:
self._yaml = yaml.load(f)
return self._yaml
def exists(self):

View File

@ -37,7 +37,8 @@ class TravisYaml(object):
def _open_travis_yaml(self):
if self._yaml is None:
self._yaml = yaml.load(open('travis.yml', 'r'))
with open('travis.yml', 'r') as f:
self._yaml = yaml.load(f)
return self._yaml
def exists(self):

View File

@ -136,7 +136,8 @@ class Runner(object):
for command in commands.prep_commands():
dockerfile.append("RUN %s\n" % command)
dockerfile = '\n'.join(dockerfile)
open(os.path.join(tempd, 'Dockerfile'), 'w').write(dockerfile)
with open(os.path.join(tempd, 'Dockerfile'), 'w') as f:
f.write(dockerfile)
logger.debug("Dockerfile:\n" + self._indent(dockerfile))
self._docker_build(self.test_image_name, tempd)
finally: