Merge pull request #4295 from radarhere/test_fixes

Improved unittest conditions
This commit is contained in:
Hugo van Kemenade 2019-12-25 10:19:37 +02:00 committed by GitHub
commit 4f6472ff0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 9 deletions

View File

@ -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 = (

View File

@ -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)

View File

@ -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"

View File

@ -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
@ -20,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)

View File

@ -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"

View File

@ -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:

View File

@ -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