mirror of
https://github.com/home-assistant/core.git
synced 2025-08-13 17:45:19 +02:00
Move variable setup and update test
This commit is contained in:
@@ -100,6 +100,7 @@ async def async_setup_hass(
|
|||||||
) -> core.HomeAssistant | None:
|
) -> core.HomeAssistant | None:
|
||||||
"""Set up Home Assistant."""
|
"""Set up Home Assistant."""
|
||||||
hass = core.HomeAssistant()
|
hass = core.HomeAssistant()
|
||||||
|
core._cv_hass.set(hass) # pylint: disable=protected-access
|
||||||
hass.config.config_dir = runtime_config.config_dir
|
hass.config.config_dir = runtime_config.config_dir
|
||||||
|
|
||||||
async_enable_logging(
|
async_enable_logging(
|
||||||
@@ -187,8 +188,6 @@ async def async_setup_hass(
|
|||||||
if runtime_config.open_ui:
|
if runtime_config.open_ui:
|
||||||
hass.add_job(open_hass_ui, hass)
|
hass.add_job(open_hass_ui, hass)
|
||||||
|
|
||||||
core._cv_hass.set(hass) # pylint: disable=protected-access
|
|
||||||
|
|
||||||
return hass
|
return hass
|
||||||
|
|
||||||
|
|
||||||
|
@@ -501,6 +501,8 @@ async def test_setup_hass(
|
|||||||
assert len(mock_ensure_config_exists.mock_calls) == 1
|
assert len(mock_ensure_config_exists.mock_calls) == 1
|
||||||
assert len(mock_process_ha_config_upgrade.mock_calls) == 1
|
assert len(mock_process_ha_config_upgrade.mock_calls) == 1
|
||||||
|
|
||||||
|
assert hass == core.async_get_hass()
|
||||||
|
|
||||||
|
|
||||||
async def test_setup_hass_takes_longer_than_log_slow_startup(
|
async def test_setup_hass_takes_longer_than_log_slow_startup(
|
||||||
mock_enable_logging,
|
mock_enable_logging,
|
||||||
|
Reference in New Issue
Block a user