mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
add test for --report argument and features.pilinfo(supported_formats)
This commit is contained in:
parent
07f2b965ed
commit
e5a46ef45d
|
@ -117,9 +117,10 @@ def test_unsupported_module() -> None:
|
||||||
features.version_module(module)
|
features.version_module(module)
|
||||||
|
|
||||||
|
|
||||||
def test_pilinfo() -> None:
|
@pytest.mark.parametrize("supported_formats", (True, False))
|
||||||
|
def test_pilinfo(supported_formats) -> None:
|
||||||
buf = io.StringIO()
|
buf = io.StringIO()
|
||||||
features.pilinfo(buf)
|
features.pilinfo(buf, supported_formats=supported_formats)
|
||||||
out = buf.getvalue()
|
out = buf.getvalue()
|
||||||
lines = out.splitlines()
|
lines = out.splitlines()
|
||||||
assert lines[0] == "-" * 68
|
assert lines[0] == "-" * 68
|
||||||
|
@ -148,4 +149,4 @@ def test_pilinfo() -> None:
|
||||||
+ "-" * 68
|
+ "-" * 68
|
||||||
+ "\n"
|
+ "\n"
|
||||||
)
|
)
|
||||||
assert jpeg in out
|
assert supported_formats == (jpeg in out)
|
||||||
|
|
|
@ -4,9 +4,15 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
def test_main() -> None:
|
|
||||||
out = subprocess.check_output([sys.executable, "-m", "PIL"]).decode("utf-8")
|
@pytest.mark.parametrize("report", (False, True))
|
||||||
|
def test_main(report) -> None:
|
||||||
|
args = [sys.executable, "-m", "PIL"]
|
||||||
|
if report:
|
||||||
|
args.append("--report")
|
||||||
|
out = subprocess.check_output(args).decode("utf-8")
|
||||||
lines = out.splitlines()
|
lines = out.splitlines()
|
||||||
assert lines[0] == "-" * 68
|
assert lines[0] == "-" * 68
|
||||||
assert lines[1].startswith("Pillow ")
|
assert lines[1].startswith("Pillow ")
|
||||||
|
@ -37,4 +43,4 @@ def test_main() -> None:
|
||||||
+ "-" * 68
|
+ "-" * 68
|
||||||
+ os.linesep
|
+ os.linesep
|
||||||
)
|
)
|
||||||
assert jpeg in out
|
assert report == (jpeg not in out)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user