From 9a72ad4fa954c5c5a0160ed28d8d73d60df9df43 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 25 Dec 2019 15:32:26 +1100 Subject: [PATCH 1/2] Removed condition already present from inheritance --- Tests/test_font_leaks.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tests/test_font_leaks.py b/Tests/test_font_leaks.py index 393ddb0fb..a32cbd81c 100644 --- a/Tests/test_font_leaks.py +++ b/Tests/test_font_leaks.py @@ -2,10 +2,9 @@ import unittest from PIL import Image, ImageDraw, ImageFont, features -from .helper import PillowLeakTestCase, is_win32 +from .helper import PillowLeakTestCase -@unittest.skipIf(is_win32(), "requires Unix or macOS") class TestTTypeFontLeak(PillowLeakTestCase): # fails at iteration 3 in master iterations = 10 From 666b726626def75f70e14ba1002cf4a9785ac28b Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 25 Dec 2019 14:13:16 +1100 Subject: [PATCH 2/2] Simplified conditions --- Tests/test_file_msp.py | 2 +- Tests/test_file_sun.py | 2 +- Tests/test_file_webp.py | 2 +- Tests/test_font_leaks.py | 2 +- Tests/test_imagefont_bitmap.py | 2 +- Tests/test_imagetk.py | 2 +- Tests/test_util.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Tests/test_file_msp.py b/Tests/test_file_msp.py index 51189b83b..18c312046 100644 --- a/Tests/test_file_msp.py +++ b/Tests/test_file_msp.py @@ -49,7 +49,7 @@ class TestFileMsp(PillowTestCase): with Image.open(target_path) as target: self.assert_image_equal(im, target) - @unittest.skipIf(not os.path.exists(EXTRA_DIR), "Extra image files not installed") + @unittest.skipUnless(os.path.exists(EXTRA_DIR), "Extra image files not installed") def test_open_windows_v2(self): files = ( diff --git a/Tests/test_file_sun.py b/Tests/test_file_sun.py index 835aead79..6fe9ff29c 100644 --- a/Tests/test_file_sun.py +++ b/Tests/test_file_sun.py @@ -30,7 +30,7 @@ class TestFileSun(PillowTestCase): with Image.open("Tests/images/sunraster.im1.png") as target: self.assert_image_equal(im, target) - @unittest.skipIf(not os.path.exists(EXTRA_DIR), "Extra image files not installed") + @unittest.skipUnless(os.path.exists(EXTRA_DIR), "Extra image files not installed") def test_others(self): files = ( os.path.join(EXTRA_DIR, f) diff --git a/Tests/test_file_webp.py b/Tests/test_file_webp.py index a2fdbc333..00028edb4 100644 --- a/Tests/test_file_webp.py +++ b/Tests/test_file_webp.py @@ -26,7 +26,7 @@ class TestUnsupportedWebp(PillowTestCase): WebPImagePlugin.SUPPORTED = True -@unittest.skipIf(not HAVE_WEBP, "WebP support not installed") +@unittest.skipUnless(HAVE_WEBP, "WebP support not installed") class TestFileWebp(PillowTestCase): def setUp(self): self.rgb_mode = "RGB" diff --git a/Tests/test_font_leaks.py b/Tests/test_font_leaks.py index a32cbd81c..be0612fa2 100644 --- a/Tests/test_font_leaks.py +++ b/Tests/test_font_leaks.py @@ -19,7 +19,7 @@ class TestTTypeFontLeak(PillowLeakTestCase): ) ) - @unittest.skipIf(not features.check("freetype2"), "Test requires freetype2") + @unittest.skipUnless(features.check("freetype2"), "Test requires freetype2") def test_leak(self): ttype = ImageFont.truetype("Tests/fonts/FreeMono.ttf", 20) self._test_font(ttype) diff --git a/Tests/test_imagefont_bitmap.py b/Tests/test_imagefont_bitmap.py index eed0c70b6..6853504f6 100644 --- a/Tests/test_imagefont_bitmap.py +++ b/Tests/test_imagefont_bitmap.py @@ -11,7 +11,7 @@ except ImportError: image_font_installed = False -@unittest.skipIf(not image_font_installed, "image font not installed") +@unittest.skipUnless(image_font_installed, "image font not installed") class TestImageFontBitmap(PillowTestCase): def test_similar(self): text = "EmbeddedBitmap" diff --git a/Tests/test_imagetk.py b/Tests/test_imagetk.py index 5ee994dc7..e6032cc2e 100644 --- a/Tests/test_imagetk.py +++ b/Tests/test_imagetk.py @@ -18,7 +18,7 @@ except (OSError, ImportError): TK_MODES = ("1", "L", "P", "RGB", "RGBA") -@unittest.skipIf(not HAS_TK, "Tk not installed") +@unittest.skipUnless(HAS_TK, "Tk not installed") class TestImageTk(PillowTestCase): def setUp(self): try: diff --git a/Tests/test_util.py b/Tests/test_util.py index 6a111b5b9..c3ef29409 100644 --- a/Tests/test_util.py +++ b/Tests/test_util.py @@ -16,7 +16,7 @@ class TestUtil(PillowTestCase): # Assert self.assertTrue(it_is) - @unittest.skipIf(not _util.py36, "os.path support for Paths added in 3.6") + @unittest.skipUnless(_util.py36, "os.path support for Paths added in 3.6") def test_path_obj_is_path(self): # Arrange from pathlib import Path