Fix unused snapshots not triggering failure in CI (#128162)
This commit is contained in:
@@ -36,6 +36,7 @@ import pytest_socket
|
||||
import requests_mock
|
||||
import respx
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
from syrupy.session import SnapshotSession
|
||||
|
||||
from homeassistant import block_async_io
|
||||
from homeassistant.exceptions import ServiceNotFound
|
||||
@@ -92,7 +93,7 @@ from homeassistant.util.async_ import create_eager_task, get_scheduled_timer_han
|
||||
from homeassistant.util.json import json_loads
|
||||
|
||||
from .ignore_uncaught_exceptions import IGNORE_UNCAUGHT_EXCEPTIONS
|
||||
from .syrupy import HomeAssistantSnapshotExtension
|
||||
from .syrupy import HomeAssistantSnapshotExtension, override_syrupy_finish
|
||||
from .typing import (
|
||||
ClientSessionGenerator,
|
||||
MockHAClientWebSocket,
|
||||
@@ -149,6 +150,11 @@ def pytest_configure(config: pytest.Config) -> None:
|
||||
if config.getoption("verbose") > 0:
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
|
||||
# Override default finish to detect unused snapshots despite xdist
|
||||
# Temporary workaround until it is finalised inside syrupy
|
||||
# See https://github.com/syrupy-project/syrupy/pull/901
|
||||
SnapshotSession.finish = override_syrupy_finish
|
||||
|
||||
|
||||
def pytest_runtest_setup() -> None:
|
||||
"""Prepare pytest_socket and freezegun.
|
||||
|
||||
Reference in New Issue
Block a user