1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Revert "Ensure frontend is available if integrations fail to start - Part 1 of 2 (#36093)" (#36251)

This reverts commit fbe7b4ddfa.
This commit is contained in:
Pascal Vizeli
2020-05-29 10:18:39 +02:00
committed by GitHub
parent 08f2714e57
commit ed014e3c96
13 changed files with 63 additions and 173 deletions

View File

@@ -201,43 +201,6 @@ async def test_setup_after_deps_not_present(hass, caplog):
assert order == ["root", "second_dep"]
async def test_setup_continues_if_blocked(hass, caplog):
"""Test we continue after timeout if blocked."""
caplog.set_level(logging.DEBUG)
order = []
def gen_domain_setup(domain):
async def async_setup(hass, config):
order.append(domain)
return True
return async_setup
mock_integration(
hass, MockModule(domain="root", async_setup=gen_domain_setup("root"))
)
mock_integration(
hass,
MockModule(
domain="second_dep",
async_setup=gen_domain_setup("second_dep"),
partial_manifest={"after_dependencies": ["first_dep"]},
),
)
with patch.object(bootstrap, "TIMEOUT_EVENT_BOOTSTRAP", 0):
hass.async_create_task(asyncio.sleep(2))
await bootstrap._async_set_up_integrations(
hass, {"root": {}, "first_dep": {}, "second_dep": {}}
)
assert "root" in hass.config.components
assert "first_dep" not in hass.config.components
assert "second_dep" in hass.config.components
assert order == ["root", "second_dep"]
assert "blocking Home Assistant from wrapping up" in caplog.text
@pytest.fixture
def mock_is_virtual_env():
"""Mock enable logging."""
@@ -298,9 +261,7 @@ async def test_setup_hass(
with patch(
"homeassistant.config.async_hass_config_yaml",
return_value={"browser": {}, "frontend": {}},
), patch.object(bootstrap, "LOG_SLOW_STARTUP_INTERVAL", 5000), patch(
"homeassistant.components.http.start_http_server_and_save_config"
):
), patch.object(bootstrap, "LOG_SLOW_STARTUP_INTERVAL", 5000):
hass = await bootstrap.async_setup_hass(
config_dir=get_test_config_dir(),
verbose=verbose,
@@ -377,7 +338,7 @@ async def test_setup_hass_invalid_yaml(
"""Test it works."""
with patch(
"homeassistant.config.async_hass_config_yaml", side_effect=HomeAssistantError
), patch("homeassistant.components.http.start_http_server_and_save_config"):
):
hass = await bootstrap.async_setup_hass(
config_dir=get_test_config_dir(),
verbose=False,
@@ -430,9 +391,7 @@ async def test_setup_hass_safe_mode(
hass.config_entries._async_schedule_save()
await flush_store(hass.config_entries._store)
with patch("homeassistant.components.browser.setup") as browser_setup, patch(
"homeassistant.components.http.start_http_server_and_save_config"
):
with patch("homeassistant.components.browser.setup") as browser_setup:
hass = await bootstrap.async_setup_hass(
config_dir=get_test_config_dir(),
verbose=False,
@@ -462,7 +421,7 @@ async def test_setup_hass_invalid_core_config(
with patch(
"homeassistant.config.async_hass_config_yaml",
return_value={"homeassistant": {"non-existing": 1}},
), patch("homeassistant.components.http.start_http_server_and_save_config"):
):
hass = await bootstrap.async_setup_hass(
config_dir=get_test_config_dir(),
verbose=False,
@@ -492,7 +451,7 @@ async def test_setup_safe_mode_if_no_frontend(
with patch(
"homeassistant.config.async_hass_config_yaml",
return_value={"map": {}, "person": {"invalid": True}},
), patch("homeassistant.components.http.start_http_server_and_save_config"):
):
hass = await bootstrap.async_setup_hass(
config_dir=get_test_config_dir(),
verbose=verbose,