From 89e3a48751e4f74b641632b7a6483919096757eb Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 26 Apr 2022 04:42:28 -1000 Subject: [PATCH] Use database executor in migration test (#70774) --- tests/components/recorder/test_migrate.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/components/recorder/test_migrate.py b/tests/components/recorder/test_migrate.py index b32ee399bd8..4663d874326 100644 --- a/tests/components/recorder/test_migrate.py +++ b/tests/components/recorder/test_migrate.py @@ -193,7 +193,9 @@ async def test_events_during_migration_are_queued(hass): await async_wait_recording_done(hass) assert recorder.util.async_migration_in_progress(hass) is False - db_states = await hass.async_add_executor_job(_get_native_states, hass, "my.entity") + db_states = await recorder.get_instance(hass).async_add_executor_job( + _get_native_states, hass, "my.entity" + ) assert len(db_states) == 2 @@ -221,11 +223,15 @@ async def test_events_during_migration_queue_exhausted(hass): await async_wait_recording_done(hass) assert recorder.util.async_migration_in_progress(hass) is False - db_states = await hass.async_add_executor_job(_get_native_states, hass, "my.entity") + db_states = await recorder.get_instance(hass).async_add_executor_job( + _get_native_states, hass, "my.entity" + ) assert len(db_states) == 1 hass.states.async_set("my.entity", "on", {}) await async_wait_recording_done(hass) - db_states = await hass.async_add_executor_job(_get_native_states, hass, "my.entity") + db_states = await recorder.get_instance(hass).async_add_executor_job( + _get_native_states, hass, "my.entity" + ) assert len(db_states) == 2