Fix several ResourceWarning: unclosed file

This commit is contained in:
Mickaël Schoentgen 2018-08-10 10:21:20 +02:00
parent abee146199
commit 67d6fcb0f6
10 changed files with 78 additions and 34 deletions

View file

@ -415,7 +415,8 @@ def test_replace_old_commit_script(tempdir_factory, store):
runner = Runner(path, C.CONFIG_FILE)
# Install a script that looks like our old script
pre_commit_contents = io.open(resource_filename('hook-tmpl')).read()
with io.open(resource_filename('hook-tmpl')) as f:
pre_commit_contents = f.read()
new_contents = pre_commit_contents.replace(
CURRENT_HASH, PRIOR_HASHES[-1],
)