Ensure that a file is closed in the tests

This commit is contained in:
Alex Gaynor 2014-03-30 11:50:18 -07:00
parent 69a4f383f6
commit 92dbf34286
1 changed files with 2 additions and 1 deletions

View File

@ -52,7 +52,8 @@ class DumpDataAssertMixin(object):
'exclude': exclude_list,
'primary_keys': primary_keys})
if filename:
command_output = open(filename, "r").read()
with open(filename, "r") as f:
command_output = f.read()
os.remove(filename)
else:
command_output = new_io.getvalue().strip()