mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Print out lists of failed tests (and temporarily force a failure for testing)
This commit is contained in:
parent
e70b5ff9b2
commit
267cdf523e
27
Tests/run.py
27
Tests/run.py
|
@ -2,7 +2,12 @@ from __future__ import print_function
|
||||||
|
|
||||||
# minimal test runner
|
# minimal test runner
|
||||||
|
|
||||||
import glob, os, os.path, sys, tempfile, re
|
import glob
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
try:
|
try:
|
||||||
root = os.path.dirname(__file__)
|
root = os.path.dirname(__file__)
|
||||||
|
@ -34,6 +39,7 @@ files.sort()
|
||||||
success = failure = 0
|
success = failure = 0
|
||||||
include = [x for x in sys.argv[1:] if x[:2] != "--"]
|
include = [x for x in sys.argv[1:] if x[:2] != "--"]
|
||||||
skipped = []
|
skipped = []
|
||||||
|
failed = []
|
||||||
|
|
||||||
python_options = " ".join(python_options)
|
python_options = " ".join(python_options)
|
||||||
tester_options = " ".join(tester_options)
|
tester_options = " ".join(tester_options)
|
||||||
|
@ -48,8 +54,8 @@ for file in files:
|
||||||
# 2>&1 works on unix and on modern windowses. we might care about
|
# 2>&1 works on unix and on modern windowses. we might care about
|
||||||
# very old Python versions, but not ancient microsoft products :-)
|
# very old Python versions, but not ancient microsoft products :-)
|
||||||
out = os.popen("%s %s -u %s %s 2>&1" % (
|
out = os.popen("%s %s -u %s %s 2>&1" % (
|
||||||
sys.executable, python_options, file, tester_options
|
sys.executable, python_options, file, tester_options
|
||||||
))
|
))
|
||||||
result = out.read()
|
result = out.read()
|
||||||
|
|
||||||
# Extract any ignore patterns
|
# Extract any ignore patterns
|
||||||
|
@ -77,7 +83,7 @@ for file in files:
|
||||||
if result == "ok":
|
if result == "ok":
|
||||||
result = None
|
result = None
|
||||||
elif result == "skip":
|
elif result == "skip":
|
||||||
print("---", "skipped") # FIXME: driver should include a reason
|
print("---", "skipped") # FIXME: driver should include a reason
|
||||||
skipped.append(test)
|
skipped.append(test)
|
||||||
continue
|
continue
|
||||||
elif not result:
|
elif not result:
|
||||||
|
@ -91,7 +97,7 @@ for file in files:
|
||||||
# if there's an ok at the end, it's not really ok
|
# if there's an ok at the end, it's not really ok
|
||||||
result = result[:-3]
|
result = result[:-3]
|
||||||
print(result)
|
print(result)
|
||||||
failure = failure + 1
|
failed.append[test]
|
||||||
else:
|
else:
|
||||||
success = success + 1
|
success = success + 1
|
||||||
|
|
||||||
|
@ -105,6 +111,7 @@ if tempfiles:
|
||||||
print(file)
|
print(file)
|
||||||
print("-"*68)
|
print("-"*68)
|
||||||
|
|
||||||
|
|
||||||
def tests(n):
|
def tests(n):
|
||||||
if n == 1:
|
if n == 1:
|
||||||
return "1 test"
|
return "1 test"
|
||||||
|
@ -112,10 +119,12 @@ def tests(n):
|
||||||
return "%d tests" % n
|
return "%d tests" % n
|
||||||
|
|
||||||
if skipped:
|
if skipped:
|
||||||
print("---", tests(len(skipped)), "skipped.")
|
print("---", tests(len(skipped)), "skipped:")
|
||||||
print(skipped)
|
print(", ".join(skipped))
|
||||||
if failure:
|
if failed:
|
||||||
print("***", tests(failure), "of", (success + failure), "failed.")
|
failure = len(failed)
|
||||||
|
print("***", tests(failure), "of", (success + failure), "failed:")
|
||||||
|
print(", ".join(failed))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print(tests(success), "passed.")
|
print(tests(success), "passed.")
|
||||||
|
|
|
@ -2,6 +2,7 @@ from tester import *
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
|
|
||||||
def verify(im1):
|
def verify(im1):
|
||||||
im2 = lena("I")
|
im2 = lena("I")
|
||||||
assert_equal(im1.size, im2.size)
|
assert_equal(im1.size, im2.size)
|
||||||
|
@ -18,6 +19,7 @@ def verify(im1):
|
||||||
return
|
return
|
||||||
success()
|
success()
|
||||||
|
|
||||||
|
|
||||||
def test_basic():
|
def test_basic():
|
||||||
# PIL 1.1 has limited support for 16-bit image data. Check that
|
# PIL 1.1 has limited support for 16-bit image data. Check that
|
||||||
# create/copy/transform and save works as expected.
|
# create/copy/transform and save works as expected.
|
||||||
|
@ -30,10 +32,10 @@ def test_basic():
|
||||||
w, h = imIn.size
|
w, h = imIn.size
|
||||||
|
|
||||||
imOut = imIn.copy()
|
imOut = imIn.copy()
|
||||||
verify(imOut) # copy
|
verify(imOut) # copy
|
||||||
|
|
||||||
imOut = imIn.transform((w, h), Image.EXTENT, (0, 0, w, h))
|
imOut = imIn.transform((w, h), Image.EXTENT, (0, 0, w, h))
|
||||||
verify(imOut) # transform
|
verify(imOut) # transform
|
||||||
|
|
||||||
filename = tempfile("temp.im")
|
filename = tempfile("temp.im")
|
||||||
imIn.save(filename)
|
imIn.save(filename)
|
||||||
|
@ -103,3 +105,5 @@ def test_convert():
|
||||||
verify(im.convert("I;16B"))
|
verify(im.convert("I;16B"))
|
||||||
verify(im.convert("I;16B").convert("L"))
|
verify(im.convert("I;16B").convert("L"))
|
||||||
verify(im.convert("I;16B").convert("I"))
|
verify(im.convert("I;16B").convert("I"))
|
||||||
|
|
||||||
|
assert(False) # TEMP FOR TESTING!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user