2023-12-21 14:13:31 +03:00
|
|
|
from __future__ import annotations
|
2020-02-17 21:31:38 +03:00
|
|
|
import io
|
|
|
|
|
2019-11-02 09:06:51 +03:00
|
|
|
|
2020-02-17 21:31:38 +03:00
|
|
|
def pytest_report_header(config):
|
2019-11-02 09:06:51 +03:00
|
|
|
try:
|
2019-11-03 01:12:52 +03:00
|
|
|
from PIL import features
|
2019-11-02 09:06:51 +03:00
|
|
|
|
2019-11-03 01:12:52 +03:00
|
|
|
with io.StringIO() as out:
|
|
|
|
features.pilinfo(out=out, supported_formats=False)
|
|
|
|
return out.getvalue()
|
2019-11-02 09:06:51 +03:00
|
|
|
except Exception as e:
|
2020-07-16 12:43:29 +03:00
|
|
|
return f"pytest_report_header failed: {e}"
|
2020-12-28 15:48:46 +03:00
|
|
|
|
2020-12-30 06:41:22 +03:00
|
|
|
|
2020-12-28 15:48:46 +03:00
|
|
|
def pytest_configure(config):
|
2021-04-10 13:03:15 +03:00
|
|
|
config.addinivalue_line(
|
|
|
|
"markers",
|
|
|
|
"pil_noop_mark: A conditional mark where nothing special happens",
|
|
|
|
)
|
|
|
|
|
2020-12-28 15:48:46 +03:00
|
|
|
# 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
|
2021-03-12 01:13:15 +03:00
|
|
|
try:
|
|
|
|
config.addinivalue_line(
|
|
|
|
"markers",
|
|
|
|
"valgrind_known_error: Tests that have known issues with valgrind",
|
|
|
|
)
|
|
|
|
except Exception:
|
|
|
|
# valgrind is already installed
|
|
|
|
pass
|