mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
Simplify test skipping
This commit is contained in:
parent
da9a3dae63
commit
901c1e2aea
|
@ -5,18 +5,13 @@ from PIL import Image
|
||||||
try:
|
try:
|
||||||
from PIL import _webp
|
from PIL import _webp
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
_webp = None
|
||||||
# Skip in setUp()
|
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(_webp is None, "WebP support not installed")
|
||||||
class TestFileWebpAlpha(PillowTestCase):
|
class TestFileWebpAlpha(PillowTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
try:
|
|
||||||
from PIL import _webp
|
|
||||||
except ImportError:
|
|
||||||
self.skipTest('WebP support not installed')
|
|
||||||
|
|
||||||
if _webp.WebPDecoderBuggyAlpha(self):
|
if _webp.WebPDecoderBuggyAlpha(self):
|
||||||
self.skipTest("Buggy early version of WebP installed, "
|
self.skipTest("Buggy early version of WebP installed, "
|
||||||
"not testing transparency")
|
"not testing transparency")
|
||||||
|
|
|
@ -18,11 +18,10 @@ except (OSError, ImportError) as v:
|
||||||
TK_MODES = ('1', 'L', 'P', 'RGB', 'RGBA')
|
TK_MODES = ('1', 'L', 'P', 'RGB', 'RGBA')
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(not HAS_TK, "Tk not installed")
|
||||||
class TestImageTk(PillowTestCase):
|
class TestImageTk(PillowTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
if not HAS_TK:
|
|
||||||
self.skipTest("Tk not installed")
|
|
||||||
try:
|
try:
|
||||||
# setup tk
|
# setup tk
|
||||||
tk.Frame()
|
tk.Frame()
|
||||||
|
|
|
@ -8,9 +8,9 @@ except ImportError:
|
||||||
pyroma = None
|
pyroma = None
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(pyroma is None, "Pyroma is not installed")
|
||||||
class TestPyroma(PillowTestCase):
|
class TestPyroma(PillowTestCase):
|
||||||
|
|
||||||
@unittest.skipUnless(pyroma, "Pyroma is not installed")
|
|
||||||
def test_pyroma(self):
|
def test_pyroma(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
data = pyroma.projectdata.get_data(".")
|
data = pyroma.projectdata.get_data(".")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user