mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
Merge pull request #10522 from AlanCoding/close_file
Close file before returning Resolves /home/alancoding/repos/tower-qa/tests/lib/plugins/pytest_restqa/plugin.py:122: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/alancoding/repos/tower-qa/scripts/resource_loading/data_latest_loading.yml' mode='r' encoding='UTF-8'> qe_config.resources = PseudoNamespace(yaml_file.load_file(config.option.resource_file)) We have this same pattern earlier in the file. Reviewed-by: Shane McDonald <me@shanemcd.com>
This commit is contained in:
commit
c09cad3e6d
@ -89,9 +89,9 @@ def load_file(filename):
|
||||
path = local(filename)
|
||||
|
||||
if path.check():
|
||||
fp = path.open()
|
||||
# FIXME - support load_all()
|
||||
return yaml.load(fp, Loader=Loader)
|
||||
with open(path, 'r') as fp:
|
||||
# FIXME - support load_all()
|
||||
return yaml.load(fp, Loader=Loader)
|
||||
else:
|
||||
msg = 'Unable to load data file at %s' % path
|
||||
raise Exception(msg)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user