Browse files

Ensure that a file is closed in the tests

  • Loading branch information...
1 parent 69a4f38 commit 92dbf342868e68dfe60569c60dd5aa5925194221 @alex alex committed Mar 30, 2014
Showing with 2 additions and 1 deletion.
  1. +2 −1 tests/fixtures/tests.py
View
3 tests/fixtures/tests.py
@@ -52,7 +52,8 @@ def _dumpdata_assert(self, args, output, format='json', filename=None,
'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()

0 comments on commit 92dbf34

Please sign in to comment.