Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,19 @@
import sys
import tempfile
import os
import glob

if sys.version_info[:2] <= (2, 6):
import unittest2 as unittest
else:
import unittest

def tearDownModule():
#remove me later
pass

class PillowTestCase(unittest.TestCase):

def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
self.currentResult = None # holds last result object passed to run method
# holds last result object passed to run method:
self.currentResult = None

def run(self, result=None):
self.currentResult = result # remember result for use later
Expand All @@ -40,7 +37,7 @@ def delete_tempfile(self, path):
except OSError:
pass # report?
else:
print("=== orphaned temp file: %s" %path)
print("=== orphaned temp file: %s" % path)

def assert_almost_equal(self, a, b, msg=None, eps=1e-6):
self.assertLess(
Expand Down Expand Up @@ -134,16 +131,16 @@ def skipKnownBadTest(self, msg=None, platform=None, travis=None):
if platform is not None:
skip = sys.platform.startswith(platform)
if travis is not None:
skip = skip and (travis == bool(os.environ.get('TRAVIS',False)))
skip = skip and (travis == bool(os.environ.get('TRAVIS', False)))
if skip:
self.skipTest(msg or "Known Bad Test")

def tempfile(self, template):
assert template[:5] in ("temp.", "temp_")
(fd, path) = tempfile.mkstemp(template[4:], template[:4])
os.close(fd)
self.addCleanup(self.delete_tempfile, path)

self.addCleanup(self.delete_tempfile, path)
return path

def open_withImagemagick(self, f):
Expand All @@ -155,8 +152,8 @@ def open_withImagemagick(self, f):
from PIL import Image
return Image.open(outfile)
raise IOError()


# helpers

import sys
Expand Down Expand Up @@ -210,17 +207,21 @@ def command_succeeds(cmd):
return False
return True


def djpeg_available():
return command_succeeds(['djpeg', '--help'])


def cjpeg_available():
return command_succeeds(['cjpeg', '--help'])


def netpbm_available():
return command_succeeds(["ppmquant", "--help"]) and \
command_succeeds(["ppmtogif", "--help"])
return (command_succeeds(["ppmquant", "--help"]) and
command_succeeds(["ppmtogif", "--help"]))


def imagemagick_available():
return command_succeeds(['convert', '-version'])

# End of file
2 changes: 1 addition & 1 deletion Tests/test_000_sanity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

import PIL
import PIL.Image
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_bmp_reference.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image
import os
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_cffi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

try:
import cffi
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_decompression_bomb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_bmp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image
import io
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_eps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image, EpsImagePlugin
import io
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_fli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_gif.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena, netpbm_available
from helper import unittest, PillowTestCase, lena, netpbm_available

from PIL import Image
from PIL import GifImagePlugin
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_icns.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_ico.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_jpeg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena, py3
from helper import unittest, PillowTestCase, lena, py3
from helper import djpeg_available, cjpeg_available

import random
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_jpeg2k.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image
from io import BytesIO
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_libtiff.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena, py3
from helper import unittest, PillowTestCase, lena, py3

import os

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_libtiff_small.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, tearDownModule
from helper import unittest

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_msp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_palm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena, imagemagick_available
from helper import unittest, PillowTestCase, lena, imagemagick_available

import os.path

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_pcx.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_pdf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

import os.path

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_png.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from io import BytesIO

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_ppm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_psd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_spider.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image
from PIL import SpiderImagePlugin
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_tar.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image, TarIO

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_tiff.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena, py3
from helper import unittest, PillowTestCase, lena, py3

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_tiff_metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image, TiffImagePlugin, TiffTags

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_webp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_webp_alpha.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_webp_lossless.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_webp_metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_xbm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_xpm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_font_bdf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import FontFile, BdfFontFile

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_font_pcf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image, FontFile, PcfFontFile
from PIL import ImageFont, ImageDraw
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_format_lab.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_copy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_crop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_draft.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, fromstring, tostring
from helper import unittest, PillowTestCase, fromstring, tostring

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_filter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image
from PIL import ImageFilter
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_frombytes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_getbands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_getbbox.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_getcolors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena


class TestImageGetColors(PillowTestCase):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_getdata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena


class TestImageGetData(PillowTestCase):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_getextrema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena


class TestImageGetExtrema(PillowTestCase):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_getim.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena, py3
from helper import unittest, PillowTestCase, lena, py3


class TestImageGetIm(PillowTestCase):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_getpalette.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena


class TestImageGetPalette(PillowTestCase):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_getpixel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule
from helper import unittest, PillowTestCase

from PIL import Image

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_image_getprojection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, tearDownModule, lena
from helper import unittest, PillowTestCase, lena

from PIL import Image

Expand Down
Loading