Intelligent timeout handler for setup/bootstrap (#38329)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
@@ -488,15 +488,12 @@ async def test_component_warn_slow_setup(hass):
|
||||
assert result
|
||||
assert mock_call.called
|
||||
|
||||
assert len(mock_call.mock_calls) == 5
|
||||
assert len(mock_call.mock_calls) == 3
|
||||
timeout, logger_method = mock_call.mock_calls[0][1][:2]
|
||||
|
||||
assert timeout == setup.SLOW_SETUP_WARNING
|
||||
assert logger_method == setup._LOGGER.warning
|
||||
|
||||
timeout, function = mock_call.mock_calls[1][1][:2]
|
||||
assert timeout == setup.SLOW_SETUP_MAX_WAIT
|
||||
|
||||
assert mock_call().cancel.called
|
||||
|
||||
|
||||
@@ -508,8 +505,7 @@ async def test_platform_no_warn_slow(hass):
|
||||
with patch.object(hass.loop, "call_later") as mock_call:
|
||||
result = await setup.async_setup_component(hass, "test_component1", {})
|
||||
assert result
|
||||
timeout, function = mock_call.mock_calls[0][1][:2]
|
||||
assert timeout == setup.SLOW_SETUP_MAX_WAIT
|
||||
assert len(mock_call.mock_calls) == 0
|
||||
|
||||
|
||||
async def test_platform_error_slow_setup(hass, caplog):
|
||||
|
||||
Reference in New Issue
Block a user