mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-05 05:33:10 +03:00
Refactor cffi import and skipping
This commit is contained in:
parent
d7e4d3db3f
commit
4218a769d7
|
@ -2,8 +2,9 @@ from helper import unittest, PillowTestCase, hopper, on_appveyor
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PIL import PyAccess
|
from PIL import PyAccess
|
||||||
|
import cffi
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Skip in setUp()
|
cffi = None
|
||||||
pass
|
pass
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
@ -113,38 +114,20 @@ class TestImageGetPixel(AccessTest):
|
||||||
self.check(mode, 2**16-1)
|
self.check(mode, 2**16-1)
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(cffi is None, "No cffi")
|
||||||
class TestCffiPutPixel(TestImagePutPixel):
|
class TestCffiPutPixel(TestImagePutPixel):
|
||||||
_need_cffi_access = True
|
_need_cffi_access = True
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
try:
|
|
||||||
import cffi
|
|
||||||
assert cffi # silence warning
|
|
||||||
except ImportError:
|
|
||||||
self.skipTest("No cffi")
|
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(cffi is None, "No cffi")
|
||||||
class TestCffiGetPixel(TestImageGetPixel):
|
class TestCffiGetPixel(TestImageGetPixel):
|
||||||
_need_cffi_access = True
|
_need_cffi_access = True
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
try:
|
|
||||||
import cffi
|
|
||||||
assert cffi # silence warning
|
|
||||||
except ImportError:
|
|
||||||
self.skipTest("No cffi")
|
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(cffi is None, "No cffi")
|
||||||
class TestCffi(AccessTest):
|
class TestCffi(AccessTest):
|
||||||
_need_cffi_access = True
|
_need_cffi_access = True
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
try:
|
|
||||||
import cffi
|
|
||||||
assert cffi # silence warning
|
|
||||||
except ImportError:
|
|
||||||
self.skipTest("No cffi")
|
|
||||||
|
|
||||||
def _test_get_access(self, im):
|
def _test_get_access(self, im):
|
||||||
"""Do we get the same thing as the old pixel access
|
"""Do we get the same thing as the old pixel access
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user