ecu-tests/conftest.py

28 lines
862 B
Python

"""
Pytest configuration for this repository.
Purpose:
- Optionally register the local plugin in `conftest_plugin.py` if present.
- Avoid hard failures on environments where that file isn't available.
"""
from __future__ import annotations
import importlib
import sys
from typing import Any
def pytest_configure(config: Any) -> None:
try:
plugin = importlib.import_module("conftest_plugin")
except Exception as e:
# Soft warning only; tests can still run without the extra report features.
sys.stderr.write(f"[pytest] conftest_plugin not loaded: {e}\n")
return
# Register the plugin module so its hooks are active.
try:
config.pluginmanager.register(plugin, name="conftest_plugin")
except Exception as reg_err:
sys.stderr.write(f"[pytest] failed to register conftest_plugin: {reg_err}\n")