mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
Merge pull request #1633 from wiredfool/windows-2.6-tests
Fixing test failures on python 2.6/windows
This commit is contained in:
commit
12a9bf614b
|
@ -1,5 +1,5 @@
|
||||||
from helper import unittest, PillowTestCase, hopper, py3
|
from helper import unittest, PillowTestCase, hopper, py3
|
||||||
|
import sys
|
||||||
|
|
||||||
class TestImageGetIm(PillowTestCase):
|
class TestImageGetIm(PillowTestCase):
|
||||||
|
|
||||||
|
@ -10,7 +10,14 @@ class TestImageGetIm(PillowTestCase):
|
||||||
if py3:
|
if py3:
|
||||||
self.assertIn("PyCapsule", type_repr)
|
self.assertIn("PyCapsule", type_repr)
|
||||||
|
|
||||||
self.assertIsInstance(im.im.id, int)
|
|
||||||
|
if sys.hexversion < 0x2070000:
|
||||||
|
# py2.6 x64, windows
|
||||||
|
target_types = (int, long)
|
||||||
|
else:
|
||||||
|
target_types = (int)
|
||||||
|
|
||||||
|
self.assertIsInstance(im.im.id, target_types)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -72,7 +72,11 @@ if sys.platform.startswith('win32'):
|
||||||
memcpy(bp, ctypes.byref(bf), ctypes.sizeof(bf))
|
memcpy(bp, ctypes.byref(bf), ctypes.sizeof(bf))
|
||||||
memcpy(bp + ctypes.sizeof(bf), ctypes.byref(bi), bi.biSize)
|
memcpy(bp + ctypes.sizeof(bf), ctypes.byref(bi), bi.biSize)
|
||||||
memcpy(bp + bf.bfOffBits, pixels, bi.biSizeImage)
|
memcpy(bp + bf.bfOffBits, pixels, bi.biSizeImage)
|
||||||
return bytearray(buf)
|
try:
|
||||||
|
return bytearray(buf)
|
||||||
|
except ValueError:
|
||||||
|
# py2.6
|
||||||
|
return buffer(buf)[:]
|
||||||
|
|
||||||
class TestImageWinPointers(PillowTestCase):
|
class TestImageWinPointers(PillowTestCase):
|
||||||
def test_pointer(self):
|
def test_pointer(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user