Permalink
Browse files

Explicitly close files in the staticfiles tests.

  • Loading branch information...
1 parent 20a7a24 commit 2048bbee8c17495d5156d40073715cb9d7511c5a @alex alex committed with Alex Gaynor Aug 15, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 tests/regressiontests/staticfiles_tests/tests.py
@@ -197,9 +197,8 @@ def _get_file(self, filepath):
call_command('findstatic', filepath, all=False, verbosity=0, stdout=out)
out.seek(0)
lines = [l.strip() for l in out.readlines()]
- contents = codecs.open(
- smart_text(lines[1].strip()), "r", "utf-8").read()
- return contents
+ with codecs.open(smart_text(lines[1].strip()), "r", "utf-8") as f:
+ return f.read()
def test_all_files(self):
"""

0 comments on commit 2048bbe

Please sign in to comment.