From 92dbf342868e68dfe60569c60dd5aa5925194221 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 30 Mar 2014 11:50:18 -0700 Subject: [PATCH] Ensure that a file is closed in the tests --- tests/fixtures/tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py index de976ba666..1c106a77c2 100644 --- a/tests/fixtures/tests.py +++ b/tests/fixtures/tests.py @@ -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()