Loading tests/file_storage/tests.py +4 −3 Original line number Diff line number Diff line Loading @@ -567,7 +567,8 @@ class InconsistentGetImageDimensionsBug(unittest.TestCase): from django.core.files.images import ImageFile img_path = os.path.join(os.path.dirname(upath(__file__)), "test.png") image = ImageFile(open(img_path, 'rb')) with open(img_path, 'rb') as file: image = ImageFile(file) image_pil = Image.open(img_path) size_1, size_2 = get_image_dimensions(image), get_image_dimensions(image) self.assertEqual(image_pil.size, size_1) Loading tests/staticfiles_tests/tests.py +2 −1 Original line number Diff line number Diff line Loading @@ -783,10 +783,11 @@ class TestAppStaticStorage(TestCase): os.mkdir(self.search_path) module_path = os.path.join(self.search_path, 'foo_module') os.mkdir(module_path) open(os.path.join(module_path, '__init__.py'), 'w') self.init_file = open(os.path.join(module_path, '__init__.py'), 'w') sys.path.append(os.path.abspath(self.search_path)) def tearDown(self): self.init_file.close() sys.path.remove(os.path.abspath(self.search_path)) shutil.rmtree(self.search_path) Loading Loading
tests/file_storage/tests.py +4 −3 Original line number Diff line number Diff line Loading @@ -567,7 +567,8 @@ class InconsistentGetImageDimensionsBug(unittest.TestCase): from django.core.files.images import ImageFile img_path = os.path.join(os.path.dirname(upath(__file__)), "test.png") image = ImageFile(open(img_path, 'rb')) with open(img_path, 'rb') as file: image = ImageFile(file) image_pil = Image.open(img_path) size_1, size_2 = get_image_dimensions(image), get_image_dimensions(image) self.assertEqual(image_pil.size, size_1) Loading
tests/staticfiles_tests/tests.py +2 −1 Original line number Diff line number Diff line Loading @@ -783,10 +783,11 @@ class TestAppStaticStorage(TestCase): os.mkdir(self.search_path) module_path = os.path.join(self.search_path, 'foo_module') os.mkdir(module_path) open(os.path.join(module_path, '__init__.py'), 'w') self.init_file = open(os.path.join(module_path, '__init__.py'), 'w') sys.path.append(os.path.abspath(self.search_path)) def tearDown(self): self.init_file.close() sys.path.remove(os.path.abspath(self.search_path)) shutil.rmtree(self.search_path) Loading