Skip to content

Commit

Permalink
Sync async_test_home_assistant with core
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery committed Apr 11, 2024
1 parent 40e3127 commit 5688de7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ async def async_test_home_assistant_dev(
"""Return a Home Assistant object pointing at test config dir.
This should be copied from latest Home Assistant version,
currently Home Assistant Core 2024.4.0.
currently Home Assistant Core 2024.5.0dev0.
"""

# Local imports of features not present in min version
Expand Down Expand Up @@ -454,7 +454,6 @@ def async_create_task(coroutine, name=None, eager_start=False):
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP,
hass.config_entries._async_shutdown,
run_immediately=True,
)

# Load the registries
Expand Down Expand Up @@ -506,9 +505,9 @@ def async_create_task(coroutine, name=None, eager_start=False):

hass.set_state(CoreState.running)

@callback
def clear_instance(event):
async def clear_instance(event):
"""Clear global instance."""
await asyncio.sleep(0) # Give aiohttp one loop iteration to close
INSTANCES.remove(hass)

hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, clear_instance)
Expand Down

0 comments on commit 5688de7

Please sign in to comment.