Fixing test failures on python 2.6/windows

This commit is contained in:
wiredfool 2016-01-03 12:20:19 -08:00
parent 0f9f5cd8db
commit 21beef192a
2 changed files with 13 additions and 2 deletions

View File

@ -10,7 +10,14 @@ class TestImageGetIm(PillowTestCase):
if py3:
self.assertIn("PyCapsule", type_repr)
self.assertIsInstance(im.im.id, int)
try:
#py2.6
target_types = (int, long)
except:
target_types = (int)
self.assertIsInstance(im.im.id, target_types)
if __name__ == '__main__':

View File

@ -72,7 +72,11 @@ if sys.platform.startswith('win32'):
memcpy(bp, ctypes.byref(bf), ctypes.sizeof(bf))
memcpy(bp + ctypes.sizeof(bf), ctypes.byref(bi), bi.biSize)
memcpy(bp + bf.bfOffBits, pixels, bi.biSizeImage)
try:
return bytearray(buf)
except:
# py2.6
return buffer(buf)[:]
class TestImageWinPointers(PillowTestCase):
def test_pointer(self):