mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
Use features.pilinfo to report details about Pillow
This commit is contained in:
parent
579b6cac60
commit
5d10f8dff2
|
@ -1,40 +1,11 @@
|
||||||
def pytest_report_header(config):
|
def pytest_report_header(config):
|
||||||
import os
|
import io
|
||||||
|
|
||||||
report = []
|
|
||||||
|
|
||||||
def append(*args):
|
|
||||||
report.append(" ".join(args))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PIL import Image, features
|
from PIL import features
|
||||||
|
|
||||||
append("-" * 68)
|
with io.StringIO() as out:
|
||||||
append("Pillow", Image.__version__)
|
features.pilinfo(out=out, supported_formats=False)
|
||||||
append("-" * 68)
|
return out.getvalue()
|
||||||
append("Python modules loaded from", os.path.dirname(Image.__file__))
|
|
||||||
append("Binary modules loaded from", os.path.dirname(Image.core.__file__))
|
|
||||||
append("-" * 68)
|
|
||||||
for name, feature in [
|
|
||||||
("pil", "PIL CORE"),
|
|
||||||
("tkinter", "TKINTER"),
|
|
||||||
("freetype2", "FREETYPE2"),
|
|
||||||
("littlecms2", "LITTLECMS2"),
|
|
||||||
("webp", "WEBP"),
|
|
||||||
("transp_webp", "WEBP Transparency"),
|
|
||||||
("webp_mux", "WEBPMUX"),
|
|
||||||
("webp_anim", "WEBP Animation"),
|
|
||||||
("jpg", "JPEG"),
|
|
||||||
("jpg_2000", "OPENJPEG (JPEG2000)"),
|
|
||||||
("zlib", "ZLIB (PNG/ZIP)"),
|
|
||||||
("libtiff", "LIBTIFF"),
|
|
||||||
("raqm", "RAQM (Bidirectional Text)"),
|
|
||||||
]:
|
|
||||||
if features.check(name):
|
|
||||||
append("---", feature, "support ok")
|
|
||||||
else:
|
|
||||||
append("***", feature, "support not installed")
|
|
||||||
append("-" * 68)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return "pytest_report_header failed: %s" % str(e)
|
return "pytest_report_header failed: %s" % str(e)
|
||||||
return "\n".join(report)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user