summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests
diff options
context:
space:
mode:
authorAndriy Sokolovskiy <me@asokolovskiy.com>2015-07-02 00:37:10 +0300
committerTim Graham <timograham@gmail.com>2015-07-06 10:10:40 -0400
commitb40c551fdfaa6b1a129c89baeeefd0ede5633053 (patch)
tree6056f158d73916d4b89d910e32cac5712b0abb49 /tests/staticfiles_tests
parent69483e022ac3ddd02f086a264c3eb5e3345ccc0c (diff)
Fixed some unclosed objects in tests
Diffstat (limited to 'tests/staticfiles_tests')
-rw-r--r--tests/staticfiles_tests/test_liveserver.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/staticfiles_tests/test_liveserver.py b/tests/staticfiles_tests/test_liveserver.py
index b6dfc767e7..72dee8999c 100644
--- a/tests/staticfiles_tests/test_liveserver.py
+++ b/tests/staticfiles_tests/test_liveserver.py
@@ -4,6 +4,7 @@ django.contrib.staticfiles.testing.StaticLiveServerTestCase instead of
django.test.LiveServerTestCase.
"""
+import contextlib
import os
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
@@ -94,5 +95,5 @@ class StaticLiveServerView(LiveServerBase):
Test that StaticLiveServerTestCase use of staticfiles' serve() allows it
to discover app's static assets without having to collectstatic first.
"""
- f = self.urlopen('/static/test/file.txt')
- self.assertEqual(f.read().rstrip(b'\r\n'), b'In static directory.')
+ with contextlib.closing(self.urlopen('/static/test/file.txt')) as f:
+ self.assertEqual(f.read().rstrip(b'\r\n'), b'In static directory.')