mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Ignore spurious messages from OpenJPEG.
This commit is contained in:
parent
18d6432036
commit
946753a3b5
29
Tests/run.py
29
Tests/run.py
|
@ -2,7 +2,7 @@ from __future__ import print_function
|
||||||
|
|
||||||
# minimal test runner
|
# minimal test runner
|
||||||
|
|
||||||
import glob, os, os.path, sys, tempfile
|
import glob, os, os.path, sys, tempfile, re
|
||||||
|
|
||||||
try:
|
try:
|
||||||
root = os.path.dirname(__file__)
|
root = os.path.dirname(__file__)
|
||||||
|
@ -38,6 +38,8 @@ skipped = []
|
||||||
python_options = " ".join(python_options)
|
python_options = " ".join(python_options)
|
||||||
tester_options = " ".join(tester_options)
|
tester_options = " ".join(tester_options)
|
||||||
|
|
||||||
|
ignore_re = re.compile('^ignore: (.*)$', re.MULTILINE)
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
test, ext = os.path.splitext(os.path.basename(file))
|
test, ext = os.path.splitext(os.path.basename(file))
|
||||||
if include and test not in include:
|
if include and test not in include:
|
||||||
|
@ -48,7 +50,30 @@ for file in files:
|
||||||
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().strip()
|
result = out.read()
|
||||||
|
|
||||||
|
# Extract any ignore patterns
|
||||||
|
ignore_pats = ignore_re.findall(result)
|
||||||
|
result = ignore_re.sub('', result)
|
||||||
|
|
||||||
|
try:
|
||||||
|
def fix_re(p):
|
||||||
|
if not p.startswith('^'):
|
||||||
|
p = '^' + p
|
||||||
|
if not p.endswith('$'):
|
||||||
|
p = p + '$'
|
||||||
|
return p
|
||||||
|
|
||||||
|
ignore_res = [re.compile(fix_re(p), re.MULTILINE) for p in ignore_pats]
|
||||||
|
except:
|
||||||
|
print('(bad ignore patterns %r)' % ignore_pats)
|
||||||
|
ignore_res = []
|
||||||
|
|
||||||
|
for r in ignore_res:
|
||||||
|
result = r.sub('', result)
|
||||||
|
|
||||||
|
result = result.strip()
|
||||||
|
|
||||||
if result == "ok":
|
if result == "ok":
|
||||||
result = None
|
result = None
|
||||||
elif result == "skip":
|
elif result == "skip":
|
||||||
|
|
|
@ -8,6 +8,10 @@ codecs = dir(Image.core)
|
||||||
if "jpeg2k_encoder" not in codecs or "jpeg2k_decoder" not in codecs:
|
if "jpeg2k_encoder" not in codecs or "jpeg2k_decoder" not in codecs:
|
||||||
skip('JPEG 2000 support not available')
|
skip('JPEG 2000 support not available')
|
||||||
|
|
||||||
|
# OpenJPEG 2.0.0 outputs this debugging message sometimes; we should
|
||||||
|
# ignore it---it doesn't represent a test failure.
|
||||||
|
ignore('Not enough memory to handle tile data')
|
||||||
|
|
||||||
test_card = Image.open('Tests/images/test-card.png')
|
test_card = Image.open('Tests/images/test-card.png')
|
||||||
test_card.load()
|
test_card.load()
|
||||||
|
|
||||||
|
|
|
@ -260,6 +260,11 @@ def skip(msg=None):
|
||||||
print("skip")
|
print("skip")
|
||||||
os._exit(0) # don't run exit handlers
|
os._exit(0) # don't run exit handlers
|
||||||
|
|
||||||
|
def ignore(pattern):
|
||||||
|
"""Tells the driver to ignore messages matching the pattern, for the
|
||||||
|
duration of the current test."""
|
||||||
|
print('ignore: %s' % pattern)
|
||||||
|
|
||||||
def _setup():
|
def _setup():
|
||||||
global _logfile
|
global _logfile
|
||||||
def report():
|
def report():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user