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

@ -87,11 +87,11 @@ def test_log_and_exit(cap_out, mock_store_dir):
)
assert os.path.exists(log_file)
contents = io.open(log_file).read()
assert contents == (
'msg: FatalError: hai\n'
"I'm a stacktrace\n"
)
with io.open(log_file) as f:
assert f.read() == (
'msg: FatalError: hai\n'
"I'm a stacktrace\n"
)
def test_error_handler_non_ascii_exception(mock_store_dir):