mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 01:04:29 +03:00
Merge pull request #810 from hugovk/verbose_failfast
Tests: Be verbose and fail fast
This commit is contained in:
commit
d810e9a018
|
@ -33,11 +33,11 @@ script:
|
|||
|
||||
# Don't cover PyPy: it fails intermittently and is x5.8 slower (#640)
|
||||
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then time python selftest.py; fi
|
||||
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then time nosetests Tests/test_*.py; fi
|
||||
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then time nosetests -vx Tests/test_*.py; fi
|
||||
|
||||
# Cover the others
|
||||
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then time coverage run --append --include=PIL/* selftest.py; fi
|
||||
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then time coverage run --append --include=PIL/* -m nose Tests/test_*.py; fi
|
||||
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then time coverage run --append --include=PIL/* -m nose -vx Tests/test_*.py; fi
|
||||
|
||||
after_success:
|
||||
- coverage report
|
||||
|
|
|
@ -19,6 +19,10 @@ class PillowTestCase(unittest.TestCase):
|
|||
# holds last result object passed to run method:
|
||||
self.currentResult = None
|
||||
|
||||
# Nicer output for --verbose
|
||||
def __str__(self):
|
||||
return self.__class__.__name__ + "." + self._testMethodName
|
||||
|
||||
def run(self, result=None):
|
||||
self.currentResult = result # remember result for use later
|
||||
unittest.TestCase.run(self, result) # call superclass run method
|
||||
|
|
|
@ -5,7 +5,7 @@ from PIL import Image
|
|||
im = lena().resize((128, 100))
|
||||
|
||||
|
||||
class TestImageCrop(PillowTestCase):
|
||||
class TestImageArray(PillowTestCase):
|
||||
|
||||
def test_toarray(self):
|
||||
def test(mode):
|
||||
|
|
|
@ -29,6 +29,10 @@ class TestImageFilter(PillowTestCase):
|
|||
filter(ImageFilter.MinFilter)
|
||||
filter(ImageFilter.ModeFilter)
|
||||
filter(ImageFilter.Kernel((3, 3), list(range(9))))
|
||||
filter(ImageFilter.GaussianBlur)
|
||||
filter(ImageFilter.GaussianBlur(5))
|
||||
filter(ImageFilter.UnsharpMask)
|
||||
filter(ImageFilter.UnsharpMask(10))
|
||||
|
||||
self.assertRaises(TypeError, lambda: filter("hello"))
|
||||
|
||||
|
|
|
@ -10,6 +10,27 @@ class TestImageMode(PillowTestCase):
|
|||
im = lena()
|
||||
im.mode
|
||||
|
||||
from PIL import ImageMode
|
||||
|
||||
ImageMode.getmode("1")
|
||||
ImageMode.getmode("L")
|
||||
ImageMode.getmode("P")
|
||||
ImageMode.getmode("RGB")
|
||||
ImageMode.getmode("I")
|
||||
ImageMode.getmode("F")
|
||||
|
||||
m = ImageMode.getmode("1")
|
||||
self.assertEqual(m.mode, "1")
|
||||
self.assertEqual(m.bands, ("1",))
|
||||
self.assertEqual(m.basemode, "L")
|
||||
self.assertEqual(m.basetype, "L")
|
||||
|
||||
m = ImageMode.getmode("RGB")
|
||||
self.assertEqual(m.mode, "RGB")
|
||||
self.assertEqual(m.bands, ("R", "G", "B"))
|
||||
self.assertEqual(m.basemode, "RGB")
|
||||
self.assertEqual(m.basetype, "L")
|
||||
|
||||
def test_properties(self):
|
||||
def check(mode, *result):
|
||||
signature = (
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from helper import unittest, lena
|
||||
from helper import unittest, PillowTestCase, lena
|
||||
|
||||
|
||||
class TestImageToBytes(unittest.TestCase):
|
||||
class TestImageToBytes(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
data = lena().tobytes()
|
||||
|
|
|
@ -5,6 +5,22 @@ from PIL import Image
|
|||
|
||||
class TestImageTransform(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
from PIL import ImageTransform
|
||||
|
||||
im = Image.new("L", (100, 100))
|
||||
|
||||
seq = tuple(range(10))
|
||||
|
||||
transform = ImageTransform.AffineTransform(seq[:6])
|
||||
im.transform((100, 100), transform)
|
||||
transform = ImageTransform.ExtentTransform(seq[:4])
|
||||
im.transform((100, 100), transform)
|
||||
transform = ImageTransform.QuadTransform(seq[:8])
|
||||
im.transform((100, 100), transform)
|
||||
transform = ImageTransform.MeshTransform([(seq[:4], seq[:8])])
|
||||
im.transform((100, 100), transform)
|
||||
|
||||
def test_extent(self):
|
||||
im = lena('RGB')
|
||||
(w, h) = im.size
|
||||
|
|
|
@ -14,7 +14,7 @@ MAXBLOCK = ImageFile.MAXBLOCK
|
|||
SAFEBLOCK = ImageFile.SAFEBLOCK
|
||||
|
||||
|
||||
class TestImagePutData(PillowTestCase):
|
||||
class TestImageFile(PillowTestCase):
|
||||
|
||||
def test_parser(self):
|
||||
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
from helper import unittest, PillowTestCase
|
||||
|
||||
from PIL import ImageFilter
|
||||
|
||||
|
||||
class TestImageFilter(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
# see test_image_filter for more tests
|
||||
|
||||
# Check these run. Exceptions cause failures.
|
||||
ImageFilter.MaxFilter
|
||||
ImageFilter.MedianFilter
|
||||
ImageFilter.MinFilter
|
||||
ImageFilter.ModeFilter
|
||||
ImageFilter.Kernel((3, 3), list(range(9)))
|
||||
ImageFilter.GaussianBlur
|
||||
ImageFilter.GaussianBlur(5)
|
||||
ImageFilter.UnsharpMask
|
||||
ImageFilter.UnsharpMask(10)
|
||||
|
||||
ImageFilter.BLUR
|
||||
ImageFilter.CONTOUR
|
||||
ImageFilter.DETAIL
|
||||
ImageFilter.EDGE_ENHANCE
|
||||
ImageFilter.EDGE_ENHANCE_MORE
|
||||
ImageFilter.EMBOSS
|
||||
ImageFilter.FIND_EDGES
|
||||
ImageFilter.SMOOTH
|
||||
ImageFilter.SMOOTH_MORE
|
||||
ImageFilter.SHARPEN
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
# End of file
|
|
@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase
|
|||
try:
|
||||
from PIL import ImageGrab
|
||||
|
||||
class TestImageCopy(PillowTestCase):
|
||||
class TestImageGrab(PillowTestCase):
|
||||
|
||||
def test_grab(self):
|
||||
im = ImageGrab.grab()
|
||||
|
@ -14,7 +14,7 @@ try:
|
|||
self.assert_image(im, im.mode, im.size)
|
||||
|
||||
except ImportError:
|
||||
class TestImageCopy(PillowTestCase):
|
||||
class TestImageGrab(PillowTestCase):
|
||||
def test_skip(self):
|
||||
self.skipTest("ImportError")
|
||||
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
from helper import unittest, PillowTestCase
|
||||
|
||||
from PIL import ImageMode
|
||||
|
||||
|
||||
class TestImageMode(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
ImageMode.getmode("1")
|
||||
ImageMode.getmode("L")
|
||||
ImageMode.getmode("P")
|
||||
ImageMode.getmode("RGB")
|
||||
ImageMode.getmode("I")
|
||||
ImageMode.getmode("F")
|
||||
|
||||
m = ImageMode.getmode("1")
|
||||
self.assertEqual(m.mode, "1")
|
||||
self.assertEqual(m.bands, ("1",))
|
||||
self.assertEqual(m.basemode, "L")
|
||||
self.assertEqual(m.basetype, "L")
|
||||
|
||||
m = ImageMode.getmode("RGB")
|
||||
self.assertEqual(m.mode, "RGB")
|
||||
self.assertEqual(m.bands, ("R", "G", "B"))
|
||||
self.assertEqual(m.basemode, "RGB")
|
||||
self.assertEqual(m.basetype, "L")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
# End of file
|
|
@ -1,27 +0,0 @@
|
|||
from helper import unittest, PillowTestCase
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageTransform
|
||||
|
||||
|
||||
class TestImageTransform(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
im = Image.new("L", (100, 100))
|
||||
|
||||
seq = tuple(range(10))
|
||||
|
||||
transform = ImageTransform.AffineTransform(seq[:6])
|
||||
im.transform((100, 100), transform)
|
||||
transform = ImageTransform.ExtentTransform(seq[:4])
|
||||
im.transform((100, 100), transform)
|
||||
transform = ImageTransform.QuadTransform(seq[:8])
|
||||
im.transform((100, 100), transform)
|
||||
transform = ImageTransform.MeshTransform([(seq[:4], seq[:8])])
|
||||
im.transform((100, 100), transform)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
# End of file
|
|
@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase
|
|||
from PIL import Image
|
||||
|
||||
|
||||
class TestSanity(PillowTestCase):
|
||||
class TestLibImage(PillowTestCase):
|
||||
|
||||
def test_setmode(self):
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class TestPyroma(unittest.TestCase):
|
||||
class TestPyroma(PillowTestCase):
|
||||
|
||||
def setUp(self):
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user