mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +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:
|
||||
from PIL import PyAccess
|
||||
import cffi
|
||||
except ImportError:
|
||||
# Skip in setUp()
|
||||
cffi = None
|
||||
pass
|
||||
|
||||
from PIL import Image
|
||||
|
@ -113,38 +114,20 @@ class TestImageGetPixel(AccessTest):
|
|||
self.check(mode, 2**16-1)
|
||||
|
||||
|
||||
@unittest.skipIf(cffi is None, "No cffi")
|
||||
class TestCffiPutPixel(TestImagePutPixel):
|
||||
_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):
|
||||
_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):
|
||||
_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):
|
||||
"""Do we get the same thing as the old pixel access
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user