Test show method on CIs

This commit is contained in:
Andrew Murray 2019-09-21 22:28:05 +10:00
parent b7ad0d8852
commit 508a2b48f0
2 changed files with 14 additions and 2 deletions

View File

@ -355,6 +355,12 @@ def on_appveyor():
return "APPVEYOR" in os.environ 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": if sys.platform == "win32":
IMCONVERT = os.environ.get("MAGICK_HOME", "") IMCONVERT = os.environ.get("MAGICK_HOME", "")
if IMCONVERT: if IMCONVERT:

View File

@ -1,6 +1,6 @@
from PIL import Image, ImageShow from PIL import Image, ImageShow
from .helper import PillowTestCase, hopper from .helper import PillowTestCase, hopper, on_ci, unittest
class TestImageShow(PillowTestCase): class TestImageShow(PillowTestCase):
@ -15,7 +15,7 @@ class TestImageShow(PillowTestCase):
# Restore original state # Restore original state
ImageShow._viewers.pop() ImageShow._viewers.pop()
def test_show(self): def test_viewer_show(self):
class TestViewer(ImageShow.Viewer): class TestViewer(ImageShow.Viewer):
methodCalled = False methodCalled = False
@ -34,6 +34,12 @@ class TestImageShow(PillowTestCase):
# Restore original state # Restore original state
ImageShow._viewers.pop(0) 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): def test_viewer(self):
viewer = ImageShow.Viewer() viewer = ImageShow.Viewer()