Pillow/Tests/conftest.py

32 lines
865 B
Python
Raw Normal View History

import io
2020-12-31 01:46:16 +03:00
import warnings
import pytest
def pytest_report_header(config):
try:
from PIL import features
with io.StringIO() as out:
features.pilinfo(out=out, supported_formats=False)
return out.getvalue()
except Exception as e:
return f"pytest_report_header failed: {e}"
2020-12-30 06:41:22 +03:00
def pytest_configure(config):
# We're marking some tests to ignore valgrind errors and XFAIL them.
2020-12-30 06:41:22 +03:00
# Ensure that the mark is defined
# even in cases where pytest-valgrind isn't installed
with warnings.catch_warnings():
warnings.simplefilter("error")
try:
getattr(pytest.mark, "valgrind_known_error")
2021-01-07 17:26:23 +03:00
except Exception:
2020-12-30 06:41:22 +03:00
config.addinivalue_line(
"markers",
"valgrind_known_error: Tests that have known issues with valgrind",
)