mirror of
https://github.com/home-assistant/core.git
synced 2025-08-01 03:35:09 +02:00
Avoid nesting sessions in recorder statistics tests (#122582)
This commit is contained in:
@@ -24,6 +24,7 @@ from homeassistant.components.recorder.statistics import (
|
||||
get_last_statistics,
|
||||
get_latest_short_term_statistics_with_session,
|
||||
get_metadata,
|
||||
get_metadata_with_session,
|
||||
get_short_term_statistics_run_cache,
|
||||
list_statistic_ids,
|
||||
)
|
||||
@@ -293,14 +294,17 @@ def mock_sensor_statistics():
|
||||
}
|
||||
|
||||
def get_fake_stats(_hass, session, start, _end):
|
||||
instance = recorder.get_instance(_hass)
|
||||
return statistics.PlatformCompiledStatistics(
|
||||
[
|
||||
sensor_stats("sensor.test1", start),
|
||||
sensor_stats("sensor.test2", start),
|
||||
sensor_stats("sensor.test3", start),
|
||||
],
|
||||
get_metadata(
|
||||
_hass, statistic_ids={"sensor.test1", "sensor.test2", "sensor.test3"}
|
||||
get_metadata_with_session(
|
||||
instance,
|
||||
session,
|
||||
statistic_ids={"sensor.test1", "sensor.test2", "sensor.test3"},
|
||||
),
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user