Update ollama config_flow task to use eager_start (#115455)
The test now adds a delay because it finished too fast
This commit is contained in:
parent
f452c5b84e
commit
0bd4064212
2 changed files with 5 additions and 2 deletions
|
@ -151,7 +151,6 @@ class OllamaConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
self.download_task = self.hass.async_create_background_task(
|
||||
self.client.pull(self.model),
|
||||
f"Downloading {self.model}",
|
||||
eager_start=False,
|
||||
)
|
||||
|
||||
if self.download_task.done():
|
||||
|
|
|
@ -205,6 +205,10 @@ async def test_download_error(hass: HomeAssistant) -> None:
|
|||
ollama.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
async def _delayed_runtime_error(*args, **kwargs):
|
||||
await asyncio.sleep(0)
|
||||
raise RuntimeError
|
||||
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.ollama.config_flow.ollama.AsyncClient.list",
|
||||
|
@ -212,7 +216,7 @@ async def test_download_error(hass: HomeAssistant) -> None:
|
|||
),
|
||||
patch(
|
||||
"homeassistant.components.ollama.config_flow.ollama.AsyncClient.pull",
|
||||
side_effect=RuntimeError(),
|
||||
_delayed_runtime_error,
|
||||
),
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
|
Loading…
Add table
Reference in a new issue