Fix OS X build

PR https://github.com/python-pillow/Pillow/pull/1209 missed a `file` -> `test_file` change on line 28, which broke the Mac build. Let's also make the constant uppercase whilst we're at it.
This commit is contained in:
Hugo 2015-05-05 11:15:55 +03:00
parent 7e02582931
commit e7d85432e4

View File

@ -5,8 +5,8 @@ from PIL import Image
import sys
# sample icon file
test_file = "Tests/images/pillow.icns"
data = open(test_file, "rb").read()
TEST_FILE = "Tests/images/pillow.icns"
data = open(TEST_FILE, "rb").read()
enable_jpeg2k = hasattr(Image.core, 'jp2klib_version')
@ -16,7 +16,7 @@ class TestFileIcns(PillowTestCase):
def test_sanity(self):
# Loading this icon by default should result in the largest size
# (512x512@2x) being loaded
im = Image.open(test_file)
im = Image.open(TEST_FILE)
im.load()
self.assertEqual(im.mode, "RGBA")
self.assertEqual(im.size, (1024, 1024))
@ -25,12 +25,12 @@ class TestFileIcns(PillowTestCase):
@unittest.skipIf(sys.platform != 'darwin',
"requires MacOS")
def test_save(self):
im = Image.open(file)
im = Image.open(TEST_FILE)
test_file = self.tempfile("temp.icns")
im.save(test_file)
TEST_FILE = self.tempfile("temp.icns")
im.save(TEST_FILE)
reread = Image.open(test_file)
reread = Image.open(TEST_FILE)
self.assertEqual(reread.mode, "RGBA")
self.assertEqual(reread.size, (1024, 1024))
@ -39,11 +39,11 @@ class TestFileIcns(PillowTestCase):
def test_sizes(self):
# Check that we can load all of the sizes, and that the final pixel
# dimensions are as expected
im = Image.open(test_file)
im = Image.open(TEST_FILE)
for w, h, r in im.info['sizes']:
wr = w * r
hr = h * r
im2 = Image.open(test_file)
im2 = Image.open(TEST_FILE)
im2.size = (w, h, r)
im2.load()
self.assertEqual(im2.mode, 'RGBA')