Test ImageShow.show on CIs (#4074)

Test ImageShow.show on CIs
This commit is contained in:
Hugo van Kemenade 2019-09-21 16:21:27 +03:00 committed by GitHub
commit 0c07e9946e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -355,6 +355,12 @@ def on_appveyor():
return "APPVEYOR" in os.environ
def on_ci():
# Travis and AppVeyor have "CI"
# Azure Pipelines has "TF_BUILD"
return "CI" in os.environ or "TF_BUILD" in os.environ
if sys.platform == "win32":
IMCONVERT = os.environ.get("MAGICK_HOME", "")
if IMCONVERT:

View File

@ -1,6 +1,6 @@
from PIL import Image, ImageShow
from .helper import PillowTestCase, hopper
from .helper import PillowTestCase, hopper, on_ci, unittest
class TestImageShow(PillowTestCase):
@ -15,7 +15,7 @@ class TestImageShow(PillowTestCase):
# Restore original state
ImageShow._viewers.pop()
def test_show(self):
def test_viewer_show(self):
class TestViewer(ImageShow.Viewer):
methodCalled = False
@ -34,6 +34,12 @@ class TestImageShow(PillowTestCase):
# Restore original state
ImageShow._viewers.pop(0)
@unittest.skipUnless(on_ci(), "Only run on CIs")
def test_show(self):
for mode in ("1", "I;16", "LA", "RGB", "RGBA"):
im = hopper(mode)
self.assertTrue(ImageShow.show(im))
def test_viewer(self):
viewer = ImageShow.Viewer()