Fix flaky statistics tests (#51242)

This commit is contained in:
Erik Montnemery 2021-05-29 16:00:36 +02:00 committed by GitHub
parent c5e5787e1d
commit 27b9d7fed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import json
from unittest.mock import patch, sentinel from unittest.mock import patch, sentinel
import pytest import pytest
from pytest import approx
from homeassistant.components import history, recorder from homeassistant.components import history, recorder
from homeassistant.components.recorder.history import get_significant_states from homeassistant.components.recorder.history import get_significant_states
@ -884,9 +885,9 @@ async def test_statistics_during_period(hass, hass_ws_client):
{ {
"statistic_id": "sensor.test", "statistic_id": "sensor.test",
"start": now.isoformat(), "start": now.isoformat(),
"mean": 10.0, "mean": approx(10.0),
"min": 10.0, "min": approx(10.0),
"max": 10.0, "max": approx(10.0),
"last_reset": None, "last_reset": None,
"state": None, "state": None,
"sum": None, "sum": None,