Skip to content

Commit

Permalink
Test ImageShow.show on CIs (#4074)
Browse files Browse the repository at this point in the history
Test ImageShow.show on CIs
  • Loading branch information
hugovk committed Sep 21, 2019
2 parents b7ad0d8 + 508a2b4 commit 0c07e99
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 8 additions & 2 deletions Tests/test_imageshow.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -15,7 +15,7 @@ def test_register(self):
# Restore original state
ImageShow._viewers.pop()

def test_show(self):
def test_viewer_show(self):
class TestViewer(ImageShow.Viewer):
methodCalled = False

Expand All @@ -34,6 +34,12 @@ def show_image(self, image, **options):
# 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()

Expand Down

0 comments on commit 0c07e99

Please sign in to comment.