mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 05:35:11 +02:00
fix flakey logbook tests (will need another PR)
This commit is contained in:
@@ -5,8 +5,9 @@ from collections.abc import Callable
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock
|
||||||
|
|
||||||
|
from freezegun import freeze_time
|
||||||
import pytest
|
import pytest
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@@ -504,10 +505,7 @@ async def test_logbook_describe_event(
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert await async_setup_component(hass, "logbook", {})
|
assert await async_setup_component(hass, "logbook", {})
|
||||||
with patch(
|
with freeze_time(dt_util.utcnow() - timedelta(seconds=5)):
|
||||||
"homeassistant.util.dt.utcnow",
|
|
||||||
return_value=dt_util.utcnow() - timedelta(seconds=5),
|
|
||||||
):
|
|
||||||
hass.bus.async_fire("some_event")
|
hass.bus.async_fire("some_event")
|
||||||
await async_wait_recording_done(hass)
|
await async_wait_recording_done(hass)
|
||||||
|
|
||||||
@@ -569,10 +567,7 @@ async def test_exclude_described_event(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch(
|
with freeze_time(dt_util.utcnow() - timedelta(seconds=5)):
|
||||||
"homeassistant.util.dt.utcnow",
|
|
||||||
return_value=dt_util.utcnow() - timedelta(seconds=5),
|
|
||||||
):
|
|
||||||
hass.bus.async_fire(
|
hass.bus.async_fire(
|
||||||
"some_automation_event",
|
"some_automation_event",
|
||||||
{logbook.ATTR_NAME: name, logbook.ATTR_ENTITY_ID: entity_id},
|
{logbook.ATTR_NAME: name, logbook.ATTR_ENTITY_ID: entity_id},
|
||||||
|
Reference in New Issue
Block a user