Avoid nesting sessions in recorder statistics tests (#122582)
parent
78e24be1e7
commit
33d5ed52e6
|
@ -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"},
|
||||
),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue