Fix ollama flaky test by freezing time

This commit is contained in:
abmantis 2025-03-13 19:11:16 +00:00
parent fa57d57215
commit ffc25c7304

View File

@ -4,6 +4,7 @@ from collections.abc import AsyncGenerator
from typing import Any from typing import Any
from unittest.mock import AsyncMock, Mock, patch from unittest.mock import AsyncMock, Mock, patch
from freezegun.api import FrozenDateTimeFactory
from ollama import Message, ResponseError from ollama import Message, ResponseError
import pytest import pytest
from syrupy.assertion import SnapshotAssertion from syrupy.assertion import SnapshotAssertion
@ -404,7 +405,10 @@ async def test_unknown_hass_api(
async def test_message_history_trimming( async def test_message_history_trimming(
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_init_component hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
mock_init_component,
freezer: FrozenDateTimeFactory,
) -> None: ) -> None:
"""Test that a single message history is trimmed according to the config.""" """Test that a single message history is trimmed according to the config."""
response_idx = 0 response_idx = 0