diff --git a/Tests/test_file_webp_alpha.py b/Tests/test_file_webp_alpha.py index 60a324d18..85682e382 100644 --- a/Tests/test_file_webp_alpha.py +++ b/Tests/test_file_webp_alpha.py @@ -5,18 +5,13 @@ from PIL import Image try: from PIL import _webp except ImportError: - pass - # Skip in setUp() + _webp = None +@unittest.skipIf(_webp is None, "WebP support not installed") class TestFileWebpAlpha(PillowTestCase): def setUp(self): - try: - from PIL import _webp - except ImportError: - self.skipTest('WebP support not installed') - if _webp.WebPDecoderBuggyAlpha(self): self.skipTest("Buggy early version of WebP installed, " "not testing transparency") diff --git a/Tests/test_imagetk.py b/Tests/test_imagetk.py index 14ce74eb1..aec7429ce 100644 --- a/Tests/test_imagetk.py +++ b/Tests/test_imagetk.py @@ -18,11 +18,10 @@ except (OSError, ImportError) as v: TK_MODES = ('1', 'L', 'P', 'RGB', 'RGBA') +@unittest.skipIf(not HAS_TK, "Tk not installed") class TestImageTk(PillowTestCase): def setUp(self): - if not HAS_TK: - self.skipTest("Tk not installed") try: # setup tk tk.Frame() diff --git a/Tests/test_pyroma.py b/Tests/test_pyroma.py index e147161a7..8d23d024b 100644 --- a/Tests/test_pyroma.py +++ b/Tests/test_pyroma.py @@ -8,9 +8,9 @@ except ImportError: pyroma = None +@unittest.skipIf(pyroma is None, "Pyroma is not installed") class TestPyroma(PillowTestCase): - @unittest.skipUnless(pyroma, "Pyroma is not installed") def test_pyroma(self): # Arrange data = pyroma.projectdata.get_data(".")