diff options
author | Claude Paroz <claude@2xlibre.net> | 2014-01-02 21:36:15 +0100 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2014-01-03 13:37:14 +0100 |
commit | 196f0a356df9c5dbdc28b73cf45b57cc7c43af9a (patch) | |
tree | 1648518da3747496fda7daff701e15d14d00fe3e /tests/files | |
parent | a61c4293745164d3a76e7d82d75102f1906590ff (diff) | |
download | django-196f0a356df9c5dbdc28b73cf45b57cc7c43af9a.tar.gz |
Suppressed ResourceWarning in files tests
Diffstat (limited to 'tests/files')
-rw-r--r-- | tests/files/tests.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/files/tests.py b/tests/files/tests.py index 43138d9b57..f562b5748d 100644 --- a/tests/files/tests.py +++ b/tests/files/tests.py @@ -161,9 +161,9 @@ class InconsistentGetImageDimensionsBug(unittest.TestCase): Multiple calls of get_image_dimensions() should return the same size. """ img_path = os.path.join(os.path.dirname(upath(__file__)), "test.png") - with open(img_path, 'rb') as file: - image = images.ImageFile(file) - image_pil = Image.open(img_path) + with open(img_path, 'rb') as fh: + image = images.ImageFile(fh) + image_pil = Image.open(fh) size_1 = images.get_image_dimensions(image) size_2 = images.get_image_dimensions(image) self.assertEqual(image_pil.size, size_1) @@ -180,7 +180,8 @@ class InconsistentGetImageDimensionsBug(unittest.TestCase): size = images.get_image_dimensions(img_path) except zlib.error: self.fail("Exception raised from get_image_dimensions().") - self.assertEqual(size, Image.open(img_path).size) + with open(img_path, 'rb') as fh: + self.assertEqual(size, Image.open(fh).size) class FileMoveSafeTests(unittest.TestCase): |