mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Use builtin TimeoutError [e-i] (#109679)
This commit is contained in:
parent
c82933175d
commit
7a89e58873
@ -1,7 +1,6 @@
|
|||||||
"""Monitors home energy use for the ELIQ Online service."""
|
"""Monitors home energy use for the ELIQ Online service."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -83,5 +82,5 @@ class EliqSensor(SensorEntity):
|
|||||||
_LOGGER.debug("Updated power from server %d W", self.native_value)
|
_LOGGER.debug("Updated power from server %d W", self.native_value)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
_LOGGER.warning("Invalid response from ELIQ Online API")
|
_LOGGER.warning("Invalid response from ELIQ Online API")
|
||||||
except (OSError, asyncio.TimeoutError) as error:
|
except (OSError, TimeoutError) as error:
|
||||||
_LOGGER.warning("Could not connect to the ELIQ Online API: %s", error)
|
_LOGGER.warning("Could not connect to the ELIQ Online API: %s", error)
|
||||||
|
@ -296,7 +296,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
try:
|
try:
|
||||||
if not await async_wait_for_elk_to_sync(elk, LOGIN_TIMEOUT, SYNC_TIMEOUT):
|
if not await async_wait_for_elk_to_sync(elk, LOGIN_TIMEOUT, SYNC_TIMEOUT):
|
||||||
return False
|
return False
|
||||||
except asyncio.TimeoutError as exc:
|
except TimeoutError as exc:
|
||||||
raise ConfigEntryNotReady(f"Timed out connecting to {conf[CONF_HOST]}") from exc
|
raise ConfigEntryNotReady(f"Timed out connecting to {conf[CONF_HOST]}") from exc
|
||||||
|
|
||||||
elk_temp_unit = elk.panel.temperature_units
|
elk_temp_unit = elk.panel.temperature_units
|
||||||
@ -389,7 +389,7 @@ async def async_wait_for_elk_to_sync(
|
|||||||
try:
|
try:
|
||||||
async with asyncio.timeout(timeout):
|
async with asyncio.timeout(timeout):
|
||||||
await event.wait()
|
await event.wait()
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
_LOGGER.debug("Timed out waiting for %s event", name)
|
_LOGGER.debug("Timed out waiting for %s event", name)
|
||||||
elk.disconnect()
|
elk.disconnect()
|
||||||
raise
|
raise
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Config flow for Elk-M1 Control integration."""
|
"""Config flow for Elk-M1 Control integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -244,7 +243,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
info = await validate_input(user_input, self.unique_id)
|
info = await validate_input(user_input, self.unique_id)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
return {"base": "cannot_connect"}, None
|
return {"base": "cannot_connect"}, None
|
||||||
except InvalidAuth:
|
except InvalidAuth:
|
||||||
return {CONF_PASSWORD: "invalid_auth"}, None
|
return {CONF_PASSWORD: "invalid_auth"}, None
|
||||||
|
@ -934,7 +934,7 @@ async def wait_for_state_change_or_timeout(
|
|||||||
try:
|
try:
|
||||||
async with asyncio.timeout(STATE_CHANGE_WAIT_TIMEOUT):
|
async with asyncio.timeout(STATE_CHANGE_WAIT_TIMEOUT):
|
||||||
await ev.wait()
|
await ev.wait()
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
unsub()
|
unsub()
|
||||||
|
@ -31,7 +31,7 @@ async def _async_has_devices(hass: HomeAssistant) -> bool:
|
|||||||
|
|
||||||
discovery_service = await async_start_discovery_service(hass)
|
discovery_service = await async_start_discovery_service(hass)
|
||||||
|
|
||||||
with suppress(asyncio.TimeoutError):
|
with suppress(TimeoutError):
|
||||||
async with asyncio.timeout(TIMEOUT_DISCOVERY):
|
async with asyncio.timeout(TIMEOUT_DISCOVERY):
|
||||||
await controller_ready.wait()
|
await controller_ready.wait()
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
info = await validate_input(self.hass, user_input)
|
info = await validate_input(self.hass, user_input)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
errors["base"] = "timeout"
|
errors["base"] = "timeout"
|
||||||
except CannotConnect:
|
except CannotConnect:
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
|
@ -46,7 +46,7 @@ class FlickConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
try:
|
try:
|
||||||
async with asyncio.timeout(60):
|
async with asyncio.timeout(60):
|
||||||
token = await auth.async_get_access_token()
|
token = await auth.async_get_access_token()
|
||||||
except asyncio.TimeoutError as err:
|
except TimeoutError as err:
|
||||||
raise CannotConnect() from err
|
raise CannotConnect() from err
|
||||||
except AuthException as err:
|
except AuthException as err:
|
||||||
raise InvalidAuth() from err
|
raise InvalidAuth() from err
|
||||||
|
@ -58,5 +58,5 @@ class FlockNotificationService(BaseNotificationService):
|
|||||||
response.status,
|
response.status,
|
||||||
result,
|
result,
|
||||||
)
|
)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
_LOGGER.error("Timeout accessing Flock at %s", self._url)
|
_LOGGER.error("Timeout accessing Flock at %s", self._url)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
"""Constants of the FluxLed/MagicHome Integration."""
|
"""Constants of the FluxLed/MagicHome Integration."""
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import socket
|
import socket
|
||||||
from typing import Final
|
from typing import Final
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ DEFAULT_EFFECT_SPEED: Final = 50
|
|||||||
FLUX_LED_DISCOVERY: Final = "flux_led_discovery"
|
FLUX_LED_DISCOVERY: Final = "flux_led_discovery"
|
||||||
|
|
||||||
FLUX_LED_EXCEPTIONS: Final = (
|
FLUX_LED_EXCEPTIONS: Final = (
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
socket.error,
|
socket.error,
|
||||||
RuntimeError,
|
RuntimeError,
|
||||||
BrokenPipeError,
|
BrokenPipeError,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Support for the Foobot indoor air quality monitor."""
|
"""Support for the Foobot indoor air quality monitor."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -118,7 +117,7 @@ async def async_setup_platform(
|
|||||||
)
|
)
|
||||||
except (
|
except (
|
||||||
aiohttp.client_exceptions.ClientConnectorError,
|
aiohttp.client_exceptions.ClientConnectorError,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
FoobotClient.TooManyRequests,
|
FoobotClient.TooManyRequests,
|
||||||
FoobotClient.InternalError,
|
FoobotClient.InternalError,
|
||||||
) as err:
|
) as err:
|
||||||
@ -175,7 +174,7 @@ class FoobotData:
|
|||||||
)
|
)
|
||||||
except (
|
except (
|
||||||
aiohttp.client_exceptions.ClientConnectorError,
|
aiohttp.client_exceptions.ClientConnectorError,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
self._client.TooManyRequests,
|
self._client.TooManyRequests,
|
||||||
self._client.InternalError,
|
self._client.InternalError,
|
||||||
):
|
):
|
||||||
|
@ -668,7 +668,7 @@ class ForkedDaapdMaster(MediaPlayerEntity):
|
|||||||
try:
|
try:
|
||||||
async with asyncio.timeout(CALLBACK_TIMEOUT):
|
async with asyncio.timeout(CALLBACK_TIMEOUT):
|
||||||
await self._paused_event.wait() # wait for paused
|
await self._paused_event.wait() # wait for paused
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
self._pause_requested = False
|
self._pause_requested = False
|
||||||
self._paused_event.clear()
|
self._paused_event.clear()
|
||||||
|
|
||||||
@ -764,7 +764,7 @@ class ForkedDaapdMaster(MediaPlayerEntity):
|
|||||||
async with asyncio.timeout(TTS_TIMEOUT):
|
async with asyncio.timeout(TTS_TIMEOUT):
|
||||||
await self._tts_playing_event.wait()
|
await self._tts_playing_event.wait()
|
||||||
# we have started TTS, now wait for completion
|
# we have started TTS, now wait for completion
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
self._tts_requested = False
|
self._tts_requested = False
|
||||||
_LOGGER.warning("TTS request timed out")
|
_LOGGER.warning("TTS request timed out")
|
||||||
await asyncio.sleep(
|
await asyncio.sleep(
|
||||||
|
@ -96,7 +96,7 @@ async def _update_freedns(hass, session, url, auth_token):
|
|||||||
except aiohttp.ClientError:
|
except aiohttp.ClientError:
|
||||||
_LOGGER.warning("Can't connect to FreeDNS API")
|
_LOGGER.warning("Can't connect to FreeDNS API")
|
||||||
|
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
_LOGGER.warning("Timeout from FreeDNS API at %s", url)
|
_LOGGER.warning("Timeout from FreeDNS API at %s", url)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
@ -58,7 +58,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
except (
|
except (
|
||||||
ClientConnectorError,
|
ClientConnectorError,
|
||||||
FullyKioskError,
|
FullyKioskError,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
) as error:
|
) as error:
|
||||||
LOGGER.debug(error.args, exc_info=True)
|
LOGGER.debug(error.args, exc_info=True)
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""The Gardena Bluetooth integration."""
|
"""The Gardena Bluetooth integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from bleak.backends.device import BLEDevice
|
from bleak.backends.device import BLEDevice
|
||||||
@ -60,7 +59,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
)
|
)
|
||||||
uuids = await client.get_all_characteristics_uuid()
|
uuids = await client.get_all_characteristics_uuid()
|
||||||
await client.update_timestamp(dt_util.now())
|
await client.update_timestamp(dt_util.now())
|
||||||
except (asyncio.TimeoutError, CommunicationFailure, DeviceUnavailable) as exception:
|
except (TimeoutError, CommunicationFailure, DeviceUnavailable) as exception:
|
||||||
await client.disconnect()
|
await client.disconnect()
|
||||||
raise ConfigEntryNotReady(
|
raise ConfigEntryNotReady(
|
||||||
f"Unable to connect to device {address} due to {exception}"
|
f"Unable to connect to device {address} due to {exception}"
|
||||||
|
@ -45,7 +45,7 @@ class GiosFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
title=gios.station_name,
|
title=gios.station_name,
|
||||||
data=user_input,
|
data=user_input,
|
||||||
)
|
)
|
||||||
except (ApiError, ClientConnectorError, asyncio.TimeoutError):
|
except (ApiError, ClientConnectorError, TimeoutError):
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
except NoStationError:
|
except NoStationError:
|
||||||
errors[CONF_STATION_ID] = "wrong_station_id"
|
errors[CONF_STATION_ID] = "wrong_station_id"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Support for Google Actions Smart Home Control."""
|
"""Support for Google Actions Smart Home Control."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import logging
|
import logging
|
||||||
@ -216,7 +215,7 @@ class GoogleConfig(AbstractConfig):
|
|||||||
except ClientResponseError as error:
|
except ClientResponseError as error:
|
||||||
_LOGGER.error("Request for %s failed: %d", url, error.status)
|
_LOGGER.error("Request for %s failed: %d", url, error.status)
|
||||||
return error.status
|
return error.status
|
||||||
except (asyncio.TimeoutError, ClientError):
|
except (TimeoutError, ClientError):
|
||||||
_LOGGER.error("Could not contact %s", url)
|
_LOGGER.error("Could not contact %s", url)
|
||||||
return HTTPStatus.INTERNAL_SERVER_ERROR
|
return HTTPStatus.INTERNAL_SERVER_ERROR
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ async def handle_devices_execute(
|
|||||||
for entity_id, result in zip(executions, execute_results):
|
for entity_id, result in zip(executions, execute_results):
|
||||||
if result is not None:
|
if result is not None:
|
||||||
results[entity_id] = result
|
results[entity_id] = result
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
final_results = list(results.values())
|
final_results = list(results.values())
|
||||||
|
@ -292,7 +292,7 @@ class GoogleCloudTTSProvider(Provider):
|
|||||||
)
|
)
|
||||||
return _encoding, response.audio_content
|
return _encoding, response.audio_content
|
||||||
|
|
||||||
except asyncio.TimeoutError as ex:
|
except TimeoutError as ex:
|
||||||
_LOGGER.error("Timeout for Google Cloud TTS call: %s", ex)
|
_LOGGER.error("Timeout for Google Cloud TTS call: %s", ex)
|
||||||
except Exception as ex: # pylint: disable=broad-except
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
_LOGGER.exception("Error occurred during Google Cloud TTS call: %s", ex)
|
_LOGGER.exception("Error occurred during Google Cloud TTS call: %s", ex)
|
||||||
|
@ -80,7 +80,7 @@ async def _update_google_domains(hass, session, domain, user, password, timeout)
|
|||||||
except aiohttp.ClientError:
|
except aiohttp.ClientError:
|
||||||
_LOGGER.warning("Can't connect to Google Domains API")
|
_LOGGER.warning("Can't connect to Google Domains API")
|
||||||
|
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
_LOGGER.warning("Timeout from Google Domains API for domain: %s", domain)
|
_LOGGER.warning("Timeout from Google Domains API for domain: %s", domain)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
@ -28,7 +28,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
async with asyncio.timeout(delay=5):
|
async with asyncio.timeout(delay=5):
|
||||||
while not coordinator.devices:
|
while not coordinator.devices:
|
||||||
await asyncio.sleep(delay=1)
|
await asyncio.sleep(delay=1)
|
||||||
except asyncio.TimeoutError as ex:
|
except TimeoutError as ex:
|
||||||
raise ConfigEntryNotReady from ex
|
raise ConfigEntryNotReady from ex
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
||||||
|
@ -44,7 +44,7 @@ async def _async_has_devices(hass: HomeAssistant) -> bool:
|
|||||||
async with asyncio.timeout(delay=5):
|
async with asyncio.timeout(delay=5):
|
||||||
while not controller.devices:
|
while not controller.devices:
|
||||||
await asyncio.sleep(delay=1)
|
await asyncio.sleep(delay=1)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
_LOGGER.debug("No devices found")
|
_LOGGER.debug("No devices found")
|
||||||
|
|
||||||
devices_count = len(controller.devices)
|
devices_count = len(controller.devices)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Harmony data object which contains the Harmony Client."""
|
"""Harmony data object which contains the Harmony Client."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -121,7 +120,7 @@ class HarmonyData(HarmonySubscriberMixin):
|
|||||||
connected = False
|
connected = False
|
||||||
try:
|
try:
|
||||||
connected = await self._client.connect()
|
connected = await self._client.connect()
|
||||||
except (asyncio.TimeoutError, aioexc.TimeOut) as err:
|
except (TimeoutError, aioexc.TimeOut) as err:
|
||||||
await self._client.close()
|
await self._client.close()
|
||||||
raise ConfigEntryNotReady(
|
raise ConfigEntryNotReady(
|
||||||
f"{self._name}: Connection timed-out to {self._address}:8088"
|
f"{self._name}: Connection timed-out to {self._address}:8088"
|
||||||
|
@ -593,7 +593,7 @@ class HassIO:
|
|||||||
|
|
||||||
return await request.json(encoding="utf-8")
|
return await request.json(encoding="utf-8")
|
||||||
|
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
_LOGGER.error("Timeout on %s request", command)
|
_LOGGER.error("Timeout on %s request", command)
|
||||||
|
|
||||||
except aiohttp.ClientError as err:
|
except aiohttp.ClientError as err:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""HTTP Support for Hass.io."""
|
"""HTTP Support for Hass.io."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -193,7 +192,7 @@ class HassIOView(HomeAssistantView):
|
|||||||
except aiohttp.ClientError as err:
|
except aiohttp.ClientError as err:
|
||||||
_LOGGER.error("Client error on api %s request %s", path, err)
|
_LOGGER.error("Client error on api %s request %s", path, err)
|
||||||
|
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
_LOGGER.error("Client timeout error on API request %s", path)
|
_LOGGER.error("Client timeout error on API request %s", path)
|
||||||
|
|
||||||
raise HTTPBadGateway()
|
raise HTTPBadGateway()
|
||||||
|
@ -43,7 +43,7 @@ async def validate_input(hass: HomeAssistant, user_input):
|
|||||||
"""Validate the user input allows us to connect."""
|
"""Validate the user input allows us to connect."""
|
||||||
try:
|
try:
|
||||||
client = await connect_client(hass, user_input)
|
client = await connect_client(hass, user_input)
|
||||||
except asyncio.TimeoutError as err:
|
except TimeoutError as err:
|
||||||
raise CannotConnect from err
|
raise CannotConnect from err
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""The Home Assistant alerts integration."""
|
"""The Home Assistant alerts integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
@ -53,7 +52,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
f"https://alerts.home-assistant.io/alerts/{alert.alert_id}.json",
|
f"https://alerts.home-assistant.io/alerts/{alert.alert_id}.json",
|
||||||
timeout=aiohttp.ClientTimeout(total=30),
|
timeout=aiohttp.ClientTimeout(total=30),
|
||||||
)
|
)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
_LOGGER.warning("Error fetching %s: timeout", alert.filename)
|
_LOGGER.warning("Error fetching %s: timeout", alert.filename)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -43,13 +43,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
try:
|
try:
|
||||||
await conn.async_setup()
|
await conn.async_setup()
|
||||||
except (
|
except (
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
AccessoryNotFoundError,
|
AccessoryNotFoundError,
|
||||||
EncryptionError,
|
EncryptionError,
|
||||||
AccessoryDisconnectedError,
|
AccessoryDisconnectedError,
|
||||||
) as ex:
|
) as ex:
|
||||||
del hass.data[KNOWN_DEVICES][conn.unique_id]
|
del hass.data[KNOWN_DEVICES][conn.unique_id]
|
||||||
with contextlib.suppress(asyncio.TimeoutError):
|
with contextlib.suppress(TimeoutError):
|
||||||
await conn.pairing.close()
|
await conn.pairing.close()
|
||||||
raise ConfigEntryNotReady from ex
|
raise ConfigEntryNotReady from ex
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Constants for the homekit_controller component."""
|
"""Constants for the homekit_controller component."""
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from aiohomekit.exceptions import (
|
from aiohomekit.exceptions import (
|
||||||
AccessoryDisconnectedError,
|
AccessoryDisconnectedError,
|
||||||
@ -108,7 +107,7 @@ CHARACTERISTIC_PLATFORMS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
STARTUP_EXCEPTIONS = (
|
STARTUP_EXCEPTIONS = (
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
AccessoryNotFoundError,
|
AccessoryNotFoundError,
|
||||||
EncryptionError,
|
EncryptionError,
|
||||||
AccessoryDisconnectedError,
|
AccessoryDisconnectedError,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Support for Honeywell (US) Total Connect Comfort climate systems."""
|
"""Support for Honeywell (US) Total Connect Comfort climate systems."""
|
||||||
import asyncio
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
import aiosomecomfort
|
import aiosomecomfort
|
||||||
@ -68,7 +67,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||||||
aiosomecomfort.device.ConnectionError,
|
aiosomecomfort.device.ConnectionError,
|
||||||
aiosomecomfort.device.ConnectionTimeout,
|
aiosomecomfort.device.ConnectionTimeout,
|
||||||
aiosomecomfort.device.SomeComfortError,
|
aiosomecomfort.device.SomeComfortError,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
) as ex:
|
) as ex:
|
||||||
raise ConfigEntryNotReady(
|
raise ConfigEntryNotReady(
|
||||||
"Failed to initialize the Honeywell client: Connection error"
|
"Failed to initialize the Honeywell client: Connection error"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Support for Honeywell (US) Total Connect Comfort climate systems."""
|
"""Support for Honeywell (US) Total Connect Comfort climate systems."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import datetime
|
import datetime
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -508,7 +507,7 @@ class HoneywellUSThermostat(ClimateEntity):
|
|||||||
AuthError,
|
AuthError,
|
||||||
ClientConnectionError,
|
ClientConnectionError,
|
||||||
AscConnectionError,
|
AscConnectionError,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
):
|
):
|
||||||
self._retry += 1
|
self._retry += 1
|
||||||
self._attr_available = self._retry <= RETRY
|
self._attr_available = self._retry <= RETRY
|
||||||
@ -524,7 +523,7 @@ class HoneywellUSThermostat(ClimateEntity):
|
|||||||
await _login()
|
await _login()
|
||||||
return
|
return
|
||||||
|
|
||||||
except (AscConnectionError, ClientConnectionError, asyncio.TimeoutError):
|
except (AscConnectionError, ClientConnectionError, TimeoutError):
|
||||||
self._retry += 1
|
self._retry += 1
|
||||||
self._attr_available = self._retry <= RETRY
|
self._attr_available = self._retry <= RETRY
|
||||||
return
|
return
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Config flow to configure the honeywell integration."""
|
"""Config flow to configure the honeywell integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ class HoneywellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
except (
|
except (
|
||||||
aiosomecomfort.ConnectionError,
|
aiosomecomfort.ConnectionError,
|
||||||
aiosomecomfort.ConnectionTimeout,
|
aiosomecomfort.ConnectionTimeout,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
):
|
):
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ class HoneywellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
except (
|
except (
|
||||||
aiosomecomfort.ConnectionError,
|
aiosomecomfort.ConnectionError,
|
||||||
aiosomecomfort.ConnectionTimeout,
|
aiosomecomfort.ConnectionTimeout,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
):
|
):
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class HueBridge:
|
|||||||
create_config_flow(self.hass, self.host)
|
create_config_flow(self.hass, self.host)
|
||||||
return False
|
return False
|
||||||
except (
|
except (
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
client_exceptions.ClientOSError,
|
client_exceptions.ClientOSError,
|
||||||
client_exceptions.ServerDisconnectedError,
|
client_exceptions.ServerDisconnectedError,
|
||||||
client_exceptions.ContentTypeError,
|
client_exceptions.ContentTypeError,
|
||||||
|
@ -111,7 +111,7 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
bridges = await discover_nupnp(
|
bridges = await discover_nupnp(
|
||||||
websession=aiohttp_client.async_get_clientsession(self.hass)
|
websession=aiohttp_client.async_get_clientsession(self.hass)
|
||||||
)
|
)
|
||||||
except asyncio.TimeoutError:
|
except TimeoutError:
|
||||||
return self.async_abort(reason="discover_timeout")
|
return self.async_abort(reason="discover_timeout")
|
||||||
|
|
||||||
if bridges:
|
if bridges:
|
||||||
|
@ -84,7 +84,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
async def async_update_huisbaasje(energyflip: EnergyFlip) -> dict[str, dict[str, Any]]:
|
async def async_update_huisbaasje(energyflip: EnergyFlip) -> dict[str, dict[str, Any]]:
|
||||||
"""Update the data by performing a request to Huisbaasje."""
|
"""Update the data by performing a request to Huisbaasje."""
|
||||||
try:
|
try:
|
||||||
# Note: asyncio.TimeoutError and aiohttp.ClientError are already
|
# Note: TimeoutError and aiohttp.ClientError are already
|
||||||
# handled by the data update coordinator.
|
# handled by the data update coordinator.
|
||||||
async with asyncio.timeout(FETCH_TIMEOUT):
|
async with asyncio.timeout(FETCH_TIMEOUT):
|
||||||
if not energyflip.is_authenticated():
|
if not energyflip.is_authenticated():
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
"""Support for Powerview scenes from a Powerview hub."""
|
"""Support for Powerview scenes from a Powerview hub."""
|
||||||
|
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from aiohttp.client_exceptions import ServerDisconnectedError
|
from aiohttp.client_exceptions import ServerDisconnectedError
|
||||||
from aiopvapi.helpers.aiorequest import PvApiConnectionError, PvApiResponseStatusError
|
from aiopvapi.helpers.aiorequest import PvApiConnectionError, PvApiResponseStatusError
|
||||||
@ -53,7 +52,7 @@ STATE_ATTRIBUTE_ROOM_NAME = "roomName"
|
|||||||
|
|
||||||
HUB_EXCEPTIONS = (
|
HUB_EXCEPTIONS = (
|
||||||
ServerDisconnectedError,
|
ServerDisconnectedError,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
PvApiConnectionError,
|
PvApiConnectionError,
|
||||||
PvApiResponseStatusError,
|
PvApiResponseStatusError,
|
||||||
)
|
)
|
||||||
|
@ -82,7 +82,7 @@ async def async_setup_entry(
|
|||||||
# so we force a refresh when we add it if possible
|
# so we force a refresh when we add it if possible
|
||||||
shade: BaseShade = PvShade(raw_shade, pv_entry.api)
|
shade: BaseShade = PvShade(raw_shade, pv_entry.api)
|
||||||
name_before_refresh = shade.name
|
name_before_refresh = shade.name
|
||||||
with suppress(asyncio.TimeoutError):
|
with suppress(TimeoutError):
|
||||||
async with asyncio.timeout(1):
|
async with asyncio.timeout(1):
|
||||||
await shade.refresh()
|
await shade.refresh()
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
try:
|
try:
|
||||||
async with asyncio.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
mac = await hass.async_add_executor_job(ialarm.get_mac)
|
mac = await hass.async_add_executor_job(ialarm.get_mac)
|
||||||
except (asyncio.TimeoutError, ConnectionError) as ex:
|
except (TimeoutError, ConnectionError) as ex:
|
||||||
raise ConfigEntryNotReady from ex
|
raise ConfigEntryNotReady from ex
|
||||||
|
|
||||||
coordinator = IAlarmDataUpdateCoordinator(hass, ialarm, mac)
|
coordinator = IAlarmDataUpdateCoordinator(hass, ialarm, mac)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Support for iammeter via local API."""
|
"""Support for iammeter via local API."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from asyncio import timeout
|
from asyncio import timeout
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
@ -117,7 +116,7 @@ async def async_setup_platform(
|
|||||||
api = await hass.async_add_executor_job(
|
api = await hass.async_add_executor_job(
|
||||||
IamMeter, config_host, config_port, config_name
|
IamMeter, config_host, config_port, config_name
|
||||||
)
|
)
|
||||||
except asyncio.TimeoutError as err:
|
except TimeoutError as err:
|
||||||
_LOGGER.error("Device is not ready")
|
_LOGGER.error("Device is not ready")
|
||||||
raise PlatformNotReady from err
|
raise PlatformNotReady from err
|
||||||
|
|
||||||
@ -125,7 +124,7 @@ async def async_setup_platform(
|
|||||||
try:
|
try:
|
||||||
async with timeout(PLATFORM_TIMEOUT):
|
async with timeout(PLATFORM_TIMEOUT):
|
||||||
return await hass.async_add_executor_job(api.client.get_data)
|
return await hass.async_add_executor_job(api.client.get_data)
|
||||||
except asyncio.TimeoutError as err:
|
except TimeoutError as err:
|
||||||
raise UpdateFailed from err
|
raise UpdateFailed from err
|
||||||
|
|
||||||
coordinator = DataUpdateCoordinator(
|
coordinator = DataUpdateCoordinator(
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Component to embed Aqualink devices."""
|
"""Component to embed Aqualink devices."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections.abc import Awaitable, Callable, Coroutine
|
from collections.abc import Awaitable, Callable, Coroutine
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
@ -79,7 +78,7 @@ async def async_setup_entry( # noqa: C901
|
|||||||
_LOGGER.error("Failed to login: %s", login_exception)
|
_LOGGER.error("Failed to login: %s", login_exception)
|
||||||
await aqualink.close()
|
await aqualink.close()
|
||||||
return False
|
return False
|
||||||
except (asyncio.TimeoutError, httpx.HTTPError) as aio_exception:
|
except (TimeoutError, httpx.HTTPError) as aio_exception:
|
||||||
await aqualink.close()
|
await aqualink.close()
|
||||||
raise ConfigEntryNotReady(
|
raise ConfigEntryNotReady(
|
||||||
f"Error while attempting login: {aio_exception}"
|
f"Error while attempting login: {aio_exception}"
|
||||||
|
@ -75,7 +75,7 @@ def valid_image_content_type(content_type: str | None) -> str:
|
|||||||
|
|
||||||
async def _async_get_image(image_entity: ImageEntity, timeout: int) -> Image:
|
async def _async_get_image(image_entity: ImageEntity, timeout: int) -> Image:
|
||||||
"""Fetch image from an image entity."""
|
"""Fetch image from an image entity."""
|
||||||
with suppress(asyncio.CancelledError, asyncio.TimeoutError, ImageContentTypeError):
|
with suppress(asyncio.CancelledError, TimeoutError, ImageContentTypeError):
|
||||||
async with asyncio.timeout(timeout):
|
async with asyncio.timeout(timeout):
|
||||||
if image_bytes := await image_entity.async_image():
|
if image_bytes := await image_entity.async_image():
|
||||||
content_type = valid_image_content_type(image_entity.content_type)
|
content_type = valid_image_content_type(image_entity.content_type)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
"""The imap integration."""
|
"""The imap integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from aioimaplib import IMAP4_SSL, AioImapException
|
from aioimaplib import IMAP4_SSL, AioImapException
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -33,7 +31,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
raise ConfigEntryAuthFailed from err
|
raise ConfigEntryAuthFailed from err
|
||||||
except InvalidFolder as err:
|
except InvalidFolder as err:
|
||||||
raise ConfigEntryError("Selected mailbox folder is invalid.") from err
|
raise ConfigEntryError("Selected mailbox folder is invalid.") from err
|
||||||
except (asyncio.TimeoutError, AioImapException) as err:
|
except (TimeoutError, AioImapException) as err:
|
||||||
raise ConfigEntryNotReady from err
|
raise ConfigEntryNotReady from err
|
||||||
|
|
||||||
coordinator_class: type[
|
coordinator_class: type[
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Config flow for imap integration."""
|
"""Config flow for imap integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
import ssl
|
import ssl
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -108,7 +107,7 @@ async def validate_input(
|
|||||||
# See https://github.com/bamthomas/aioimaplib/issues/91
|
# See https://github.com/bamthomas/aioimaplib/issues/91
|
||||||
# This handler is added to be able to supply a better error message
|
# This handler is added to be able to supply a better error message
|
||||||
errors["base"] = "ssl_error"
|
errors["base"] = "ssl_error"
|
||||||
except (asyncio.TimeoutError, AioImapException, ConnectionRefusedError):
|
except (TimeoutError, AioImapException, ConnectionRefusedError):
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
else:
|
else:
|
||||||
if result != "OK":
|
if result != "OK":
|
||||||
|
@ -347,7 +347,7 @@ class ImapDataUpdateCoordinator(DataUpdateCoordinator[int | None]):
|
|||||||
await self.imap_client.stop_wait_server_push()
|
await self.imap_client.stop_wait_server_push()
|
||||||
await self.imap_client.close()
|
await self.imap_client.close()
|
||||||
await self.imap_client.logout()
|
await self.imap_client.logout()
|
||||||
except (AioImapException, asyncio.TimeoutError):
|
except (AioImapException, TimeoutError):
|
||||||
if log_error:
|
if log_error:
|
||||||
_LOGGER.debug("Error while cleaning up imap connection")
|
_LOGGER.debug("Error while cleaning up imap connection")
|
||||||
finally:
|
finally:
|
||||||
@ -379,7 +379,7 @@ class ImapPollingDataUpdateCoordinator(ImapDataUpdateCoordinator):
|
|||||||
except (
|
except (
|
||||||
AioImapException,
|
AioImapException,
|
||||||
UpdateFailed,
|
UpdateFailed,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
) as ex:
|
) as ex:
|
||||||
await self._cleanup()
|
await self._cleanup()
|
||||||
self.async_set_update_error(ex)
|
self.async_set_update_error(ex)
|
||||||
@ -451,7 +451,7 @@ class ImapPushDataUpdateCoordinator(ImapDataUpdateCoordinator):
|
|||||||
except (
|
except (
|
||||||
UpdateFailed,
|
UpdateFailed,
|
||||||
AioImapException,
|
AioImapException,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
) as ex:
|
) as ex:
|
||||||
await self._cleanup()
|
await self._cleanup()
|
||||||
self.async_set_update_error(ex)
|
self.async_set_update_error(ex)
|
||||||
@ -467,8 +467,7 @@ class ImapPushDataUpdateCoordinator(ImapDataUpdateCoordinator):
|
|||||||
async with asyncio.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
await idle
|
await idle
|
||||||
|
|
||||||
# From python 3.11 asyncio.TimeoutError is an alias of TimeoutError
|
except (AioImapException, TimeoutError):
|
||||||
except (AioImapException, asyncio.TimeoutError):
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Lost %s (will attempt to reconnect after %s s)",
|
"Lost %s (will attempt to reconnect after %s s)",
|
||||||
self.config_entry.data[CONF_SERVER],
|
self.config_entry.data[CONF_SERVER],
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Support for an Intergas boiler via an InComfort/Intouch Lan2RF gateway."""
|
"""Support for an Intergas boiler via an InComfort/Intouch Lan2RF gateway."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -101,7 +100,7 @@ class IncomfortWaterHeater(IncomfortEntity, WaterHeaterEntity):
|
|||||||
try:
|
try:
|
||||||
await self._heater.update()
|
await self._heater.update()
|
||||||
|
|
||||||
except (ClientResponseError, asyncio.TimeoutError) as err:
|
except (ClientResponseError, TimeoutError) as err:
|
||||||
_LOGGER.warning("Update failed, message is: %s", err)
|
_LOGGER.warning("Update failed, message is: %s", err)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -33,7 +33,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||||||
try:
|
try:
|
||||||
async with asyncio.timeout(30):
|
async with asyncio.timeout(30):
|
||||||
location = await Location.get(api, float(latitude), float(longitude))
|
location = await Location.get(api, float(latitude), float(longitude))
|
||||||
except (IPMAException, asyncio.TimeoutError) as err:
|
except (IPMAException, TimeoutError) as err:
|
||||||
raise ConfigEntryNotReady(
|
raise ConfigEntryNotReady(
|
||||||
f"Could not get location for ({latitude},{longitude})"
|
f"Could not get location for ({latitude},{longitude})"
|
||||||
) from err
|
) from err
|
||||||
|
@ -217,7 +217,7 @@ class IPMAWeather(WeatherEntity, IPMADevice):
|
|||||||
period: int,
|
period: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Try to update weather forecast."""
|
"""Try to update weather forecast."""
|
||||||
with contextlib.suppress(asyncio.TimeoutError):
|
with contextlib.suppress(TimeoutError):
|
||||||
async with asyncio.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
await self._update_forecast(forecast_type, period, False)
|
await self._update_forecast(forecast_type, period, False)
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ async def async_setup_entry(
|
|||||||
try:
|
try:
|
||||||
async with asyncio.timeout(60):
|
async with asyncio.timeout(60):
|
||||||
await isy.initialize()
|
await isy.initialize()
|
||||||
except asyncio.TimeoutError as err:
|
except TimeoutError as err:
|
||||||
raise ConfigEntryNotReady(
|
raise ConfigEntryNotReady(
|
||||||
"Timed out initializing the ISY; device may be busy, trying again later:"
|
"Timed out initializing the ISY; device may be busy, trying again later:"
|
||||||
f" {err}"
|
f" {err}"
|
||||||
|
@ -25,7 +25,7 @@ async def _async_has_devices(hass: HomeAssistant) -> bool:
|
|||||||
|
|
||||||
disco = await async_start_discovery_service(hass)
|
disco = await async_start_discovery_service(hass)
|
||||||
|
|
||||||
with suppress(asyncio.TimeoutError):
|
with suppress(TimeoutError):
|
||||||
async with asyncio.timeout(TIMEOUT_DISCOVERY):
|
async with asyncio.timeout(TIMEOUT_DISCOVERY):
|
||||||
await controller_ready.wait()
|
await controller_ready.wait()
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Test config flow."""
|
"""Test config flow."""
|
||||||
import asyncio
|
|
||||||
from ipaddress import ip_address
|
from ipaddress import ip_address
|
||||||
import json
|
import json
|
||||||
from unittest.mock import AsyncMock, MagicMock, patch
|
from unittest.mock import AsyncMock, MagicMock, patch
|
||||||
@ -500,7 +499,7 @@ async def test_user_discovers_name_and_dashboard_is_unavailable(
|
|||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"esphome_dashboard_api.ESPHomeDashboardAPI.get_devices",
|
"esphome_dashboard_api.ESPHomeDashboardAPI.get_devices",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
await dashboard.async_get_dashboard(hass).async_refresh()
|
await dashboard.async_get_dashboard(hass).async_refresh()
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Test ESPHome dashboard features."""
|
"""Test ESPHome dashboard features."""
|
||||||
import asyncio
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from aioesphomeapi import DeviceInfo, InvalidAuthAPIError
|
from aioesphomeapi import DeviceInfo, InvalidAuthAPIError
|
||||||
@ -69,7 +68,7 @@ async def test_setup_dashboard_fails(
|
|||||||
) -> MockConfigEntry:
|
) -> MockConfigEntry:
|
||||||
"""Test that nothing is stored on failed dashboard setup when there was no dashboard before."""
|
"""Test that nothing is stored on failed dashboard setup when there was no dashboard before."""
|
||||||
with patch.object(
|
with patch.object(
|
||||||
dashboard.ESPHomeDashboardAPI, "get_devices", side_effect=asyncio.TimeoutError
|
dashboard.ESPHomeDashboardAPI, "get_devices", side_effect=TimeoutError
|
||||||
) as mock_get_devices:
|
) as mock_get_devices:
|
||||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@ -99,7 +98,7 @@ async def test_setup_dashboard_fails_when_already_setup(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
with patch.object(
|
with patch.object(
|
||||||
dashboard.ESPHomeDashboardAPI, "get_devices", side_effect=asyncio.TimeoutError
|
dashboard.ESPHomeDashboardAPI, "get_devices", side_effect=TimeoutError
|
||||||
) as mock_get_devices, patch(
|
) as mock_get_devices, patch(
|
||||||
"homeassistant.components.esphome.async_setup_entry", return_value=True
|
"homeassistant.components.esphome.async_setup_entry", return_value=True
|
||||||
) as mock_setup:
|
) as mock_setup:
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Test ESPHome update entities."""
|
"""Test ESPHome update entities."""
|
||||||
import asyncio
|
|
||||||
from collections.abc import Awaitable, Callable
|
from collections.abc import Awaitable, Callable
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
@ -280,7 +279,7 @@ async def test_update_entity_dashboard_not_available_startup(
|
|||||||
return_value=Mock(available=True, device_info=mock_device_info),
|
return_value=Mock(available=True, device_info=mock_device_info),
|
||||||
), patch(
|
), patch(
|
||||||
"esphome_dashboard_api.ESPHomeDashboardAPI.get_devices",
|
"esphome_dashboard_api.ESPHomeDashboardAPI.get_devices",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
await async_get_dashboard(hass).async_refresh()
|
await async_get_dashboard(hass).async_refresh()
|
||||||
assert await hass.config_entries.async_forward_entry_setup(
|
assert await hass.config_entries.async_forward_entry_setup(
|
||||||
@ -324,7 +323,7 @@ async def test_update_entity_dashboard_discovered_after_startup_but_update_faile
|
|||||||
"""Test ESPHome update entity when dashboard is discovered after startup and the first update fails."""
|
"""Test ESPHome update entity when dashboard is discovered after startup and the first update fails."""
|
||||||
with patch(
|
with patch(
|
||||||
"esphome_dashboard_api.ESPHomeDashboardAPI.get_devices",
|
"esphome_dashboard_api.ESPHomeDashboardAPI.get_devices",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
await async_get_dashboard(hass).async_refresh()
|
await async_get_dashboard(hass).async_refresh()
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Test the Evil Genius Labs config flow."""
|
"""Test the Evil Genius Labs config flow."""
|
||||||
import asyncio
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
@ -82,7 +81,7 @@ async def test_form_timeout(hass: HomeAssistant) -> None:
|
|||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"pyevilgenius.EvilGeniusDevice.get_all",
|
"pyevilgenius.EvilGeniusDevice.get_all",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Test the Flick Electric config flow."""
|
"""Test the Flick Electric config flow."""
|
||||||
import asyncio
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from pyflick.authentication import AuthException
|
from pyflick.authentication import AuthException
|
||||||
@ -86,7 +85,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
|||||||
"""Test we handle cannot connect error."""
|
"""Test we handle cannot connect error."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.flick_electric.config_flow.SimpleFlickAuth.async_get_access_token",
|
"homeassistant.components.flick_electric.config_flow.SimpleFlickAuth.async_get_access_token",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
result = await _flow_submit(hass)
|
result = await _flow_submit(hass)
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""The tests for the Foobot sensor platform."""
|
"""The tests for the Foobot sensor platform."""
|
||||||
import asyncio
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import re
|
import re
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
@ -65,9 +64,7 @@ async def test_setup_timeout_error(
|
|||||||
"""Expected failures caused by a timeout in API response."""
|
"""Expected failures caused by a timeout in API response."""
|
||||||
fake_async_add_entities = MagicMock()
|
fake_async_add_entities = MagicMock()
|
||||||
|
|
||||||
aioclient_mock.get(
|
aioclient_mock.get(re.compile("api.foobot.io/v2/owner/.*"), exc=TimeoutError())
|
||||||
re.compile("api.foobot.io/v2/owner/.*"), exc=asyncio.TimeoutError()
|
|
||||||
)
|
|
||||||
with pytest.raises(PlatformNotReady):
|
with pytest.raises(PlatformNotReady):
|
||||||
await foobot.async_setup_platform(hass, VALID_CONFIG, fake_async_add_entities)
|
await foobot.async_setup_platform(hass, VALID_CONFIG, fake_async_add_entities)
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
"""Test the Fully Kiosk Browser config flow."""
|
"""Test the Fully Kiosk Browser config flow."""
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from unittest.mock import AsyncMock, MagicMock, Mock
|
from unittest.mock import AsyncMock, MagicMock, Mock
|
||||||
|
|
||||||
from aiohttp.client_exceptions import ClientConnectorError
|
from aiohttp.client_exceptions import ClientConnectorError
|
||||||
@ -67,7 +66,7 @@ async def test_user_flow(
|
|||||||
[
|
[
|
||||||
(FullyKioskError("error", "status"), "cannot_connect"),
|
(FullyKioskError("error", "status"), "cannot_connect"),
|
||||||
(ClientConnectorError(None, Mock()), "cannot_connect"),
|
(ClientConnectorError(None, Mock()), "cannot_connect"),
|
||||||
(asyncio.TimeoutError, "cannot_connect"),
|
(TimeoutError, "cannot_connect"),
|
||||||
(RuntimeError, "unknown"),
|
(RuntimeError, "unknown"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Tests for the Fully Kiosk Browser integration."""
|
"""Tests for the Fully Kiosk Browser integration."""
|
||||||
import asyncio
|
|
||||||
import json
|
import json
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ async def test_load_unload_config_entry(
|
|||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"side_effect",
|
"side_effect",
|
||||||
[FullyKioskError("error", "status"), asyncio.TimeoutError],
|
[FullyKioskError("error", "status"), TimeoutError],
|
||||||
)
|
)
|
||||||
async def test_config_entry_not_ready(
|
async def test_config_entry_not_ready(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
@ -249,7 +249,7 @@ async def test_limit_refetch(
|
|||||||
hass.states.async_set("sensor.temp", "5")
|
hass.states.async_set("sensor.temp", "5")
|
||||||
|
|
||||||
with pytest.raises(aiohttp.ServerTimeoutError), patch(
|
with pytest.raises(aiohttp.ServerTimeoutError), patch(
|
||||||
"asyncio.timeout", side_effect=asyncio.TimeoutError()
|
"asyncio.timeout", side_effect=TimeoutError()
|
||||||
):
|
):
|
||||||
resp = await client.get("/api/camera_proxy/camera.config_test")
|
resp = await client.get("/api/camera_proxy/camera.config_test")
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Tests for the GogoGate2 component."""
|
"""Tests for the GogoGate2 component."""
|
||||||
import asyncio
|
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from ismartgate import GogoGate2Api
|
from ismartgate import GogoGate2Api
|
||||||
@ -94,6 +93,6 @@ async def test_api_failure_on_startup(hass: HomeAssistant) -> None:
|
|||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.gogogate2.common.ISmartGateApi.async_info",
|
"homeassistant.components.gogogate2.common.ISmartGateApi.async_info",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
), pytest.raises(ConfigEntryNotReady):
|
), pytest.raises(ConfigEntryNotReady):
|
||||||
await async_setup_entry(hass, config_entry)
|
await async_setup_entry(hass, config_entry)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
"""Test Govee light local."""
|
"""Test Govee light local."""
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from unittest.mock import AsyncMock, MagicMock, patch
|
from unittest.mock import AsyncMock, MagicMock, patch
|
||||||
|
|
||||||
from govee_local_api import GoveeDevice
|
from govee_local_api import GoveeDevice
|
||||||
@ -133,7 +132,7 @@ async def test_light_setup_retry(
|
|||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.govee_light_local.asyncio.timeout",
|
"homeassistant.components.govee_light_local.asyncio.timeout",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
await hass.config_entries.async_setup(entry.entry_id)
|
await hass.config_entries.async_setup(entry.entry_id)
|
||||||
assert entry.state is ConfigEntryState.SETUP_RETRY
|
assert entry.state is ConfigEntryState.SETUP_RETRY
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""The tests for the hassio component."""
|
"""The tests for the hassio component."""
|
||||||
import asyncio
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
@ -396,7 +395,7 @@ async def test_bad_gateway_when_cannot_find_supervisor(
|
|||||||
hassio_client, aioclient_mock: AiohttpClientMocker
|
hassio_client, aioclient_mock: AiohttpClientMocker
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test we get a bad gateway error if we can't find supervisor."""
|
"""Test we get a bad gateway error if we can't find supervisor."""
|
||||||
aioclient_mock.get("http://127.0.0.1/app/entrypoint.js", exc=asyncio.TimeoutError)
|
aioclient_mock.get("http://127.0.0.1/app/entrypoint.js", exc=TimeoutError)
|
||||||
|
|
||||||
resp = await hassio_client.get("/api/hassio/app/entrypoint.js")
|
resp = await hassio_client.get("/api/hassio/app/entrypoint.js")
|
||||||
assert resp.status == HTTPStatus.BAD_GATEWAY
|
assert resp.status == HTTPStatus.BAD_GATEWAY
|
||||||
|
@ -189,7 +189,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
|||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.hlk_sw16.config_flow.connect_client",
|
"homeassistant.components.hlk_sw16.config_flow.connect_client",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
return_value=None,
|
return_value=None,
|
||||||
):
|
):
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Tests for honeywell config flow."""
|
"""Tests for honeywell config flow."""
|
||||||
import asyncio
|
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import aiosomecomfort
|
import aiosomecomfort
|
||||||
@ -213,7 +212,7 @@ async def test_reauth_flow_auth_error(hass: HomeAssistant, client: MagicMock) ->
|
|||||||
[
|
[
|
||||||
aiosomecomfort.device.ConnectionError,
|
aiosomecomfort.device.ConnectionError,
|
||||||
aiosomecomfort.device.ConnectionTimeout,
|
aiosomecomfort.device.ConnectionTimeout,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_reauth_flow_connnection_error(
|
async def test_reauth_flow_connnection_error(
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Tests for Philips Hue config flow."""
|
"""Tests for Philips Hue config flow."""
|
||||||
import asyncio
|
|
||||||
from ipaddress import ip_address
|
from ipaddress import ip_address
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
@ -254,7 +253,7 @@ async def test_flow_timeout_discovery(hass: HomeAssistant) -> None:
|
|||||||
"""Test config flow ."""
|
"""Test config flow ."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.hue.config_flow.discover_nupnp",
|
"homeassistant.components.hue.config_flow.discover_nupnp",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
const.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
const.DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Philips Hue lights platform tests."""
|
"""Philips Hue lights platform tests."""
|
||||||
import asyncio
|
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
|
|
||||||
import aiohue
|
import aiohue
|
||||||
@ -558,8 +557,8 @@ async def test_other_light_update(hass: HomeAssistant, mock_bridge_v1) -> None:
|
|||||||
|
|
||||||
async def test_update_timeout(hass: HomeAssistant, mock_bridge_v1) -> None:
|
async def test_update_timeout(hass: HomeAssistant, mock_bridge_v1) -> None:
|
||||||
"""Test bridge marked as not available if timeout error during update."""
|
"""Test bridge marked as not available if timeout error during update."""
|
||||||
mock_bridge_v1.api.lights.update = Mock(side_effect=asyncio.TimeoutError)
|
mock_bridge_v1.api.lights.update = Mock(side_effect=TimeoutError)
|
||||||
mock_bridge_v1.api.groups.update = Mock(side_effect=asyncio.TimeoutError)
|
mock_bridge_v1.api.groups.update = Mock(side_effect=TimeoutError)
|
||||||
await setup_bridge(hass, mock_bridge_v1)
|
await setup_bridge(hass, mock_bridge_v1)
|
||||||
assert len(mock_bridge_v1.mock_requests) == 0
|
assert len(mock_bridge_v1.mock_requests) == 0
|
||||||
assert len(hass.states.async_all()) == 0
|
assert len(hass.states.async_all()) == 0
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Philips Hue sensors platform tests."""
|
"""Philips Hue sensors platform tests."""
|
||||||
import asyncio
|
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
|
|
||||||
import aiohue
|
import aiohue
|
||||||
@ -433,7 +432,7 @@ async def test_sensor_removed(hass: HomeAssistant, mock_bridge_v1) -> None:
|
|||||||
|
|
||||||
async def test_update_timeout(hass: HomeAssistant, mock_bridge_v1) -> None:
|
async def test_update_timeout(hass: HomeAssistant, mock_bridge_v1) -> None:
|
||||||
"""Test bridge marked as not available if timeout error during update."""
|
"""Test bridge marked as not available if timeout error during update."""
|
||||||
mock_bridge_v1.api.sensors.update = Mock(side_effect=asyncio.TimeoutError)
|
mock_bridge_v1.api.sensors.update = Mock(side_effect=TimeoutError)
|
||||||
await setup_platform(hass, mock_bridge_v1, ["binary_sensor", "sensor"])
|
await setup_platform(hass, mock_bridge_v1, ["binary_sensor", "sensor"])
|
||||||
assert len(mock_bridge_v1.mock_requests) == 0
|
assert len(mock_bridge_v1.mock_requests) == 0
|
||||||
assert len(hass.states.async_all()) == 0
|
assert len(hass.states.async_all()) == 0
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Test the Hunter Douglas Powerview config flow."""
|
"""Test the Hunter Douglas Powerview config flow."""
|
||||||
import asyncio
|
|
||||||
from ipaddress import ip_address
|
from ipaddress import ip_address
|
||||||
import json
|
import json
|
||||||
from unittest.mock import AsyncMock, MagicMock, patch
|
from unittest.mock import AsyncMock, MagicMock, patch
|
||||||
@ -191,9 +190,7 @@ async def test_form_homekit_and_dhcp_cannot_connect(
|
|||||||
)
|
)
|
||||||
ignored_config_entry.add_to_hass(hass)
|
ignored_config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
mock_powerview_userdata = _get_mock_powerview_userdata(
|
mock_powerview_userdata = _get_mock_powerview_userdata(get_resources=TimeoutError)
|
||||||
get_resources=asyncio.TimeoutError
|
|
||||||
)
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.hunterdouglas_powerview.UserData",
|
"homeassistant.components.hunterdouglas_powerview.UserData",
|
||||||
return_value=mock_powerview_userdata,
|
return_value=mock_powerview_userdata,
|
||||||
@ -300,9 +297,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
|||||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
||||||
mock_powerview_userdata = _get_mock_powerview_userdata(
|
mock_powerview_userdata = _get_mock_powerview_userdata(get_resources=TimeoutError)
|
||||||
get_resources=asyncio.TimeoutError
|
|
||||||
)
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.hunterdouglas_powerview.UserData",
|
"homeassistant.components.hunterdouglas_powerview.UserData",
|
||||||
return_value=mock_powerview_userdata,
|
return_value=mock_powerview_userdata,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Tests for iAqualink integration."""
|
"""Tests for iAqualink integration."""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ async def test_setup_login_timeout(hass: HomeAssistant, config_entry) -> None:
|
|||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.iaqualink.AqualinkClient.login",
|
"homeassistant.components.iaqualink.AqualinkClient.login",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Test the imap config flow."""
|
"""Test the imap config flow."""
|
||||||
import asyncio
|
|
||||||
import ssl
|
import ssl
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
@ -117,7 +116,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None:
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("exc", "error"),
|
("exc", "error"),
|
||||||
[
|
[
|
||||||
(asyncio.TimeoutError, "cannot_connect"),
|
(TimeoutError, "cannot_connect"),
|
||||||
(AioImapException(""), "cannot_connect"),
|
(AioImapException(""), "cannot_connect"),
|
||||||
(ssl.SSLError, "ssl_error"),
|
(ssl.SSLError, "ssl_error"),
|
||||||
],
|
],
|
||||||
@ -306,7 +305,7 @@ async def test_reauth_failed_conn_error(hass: HomeAssistant) -> None:
|
|||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.imap.config_flow.connect_to_server",
|
"homeassistant.components.imap.config_flow.connect_to_server",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
@ -520,7 +519,7 @@ async def test_config_flow_from_with_advanced_settings(
|
|||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.imap.config_flow.connect_to_server",
|
"homeassistant.components.imap.config_flow.connect_to_server",
|
||||||
side_effect=asyncio.TimeoutError,
|
side_effect=TimeoutError,
|
||||||
):
|
):
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"], config
|
result["flow_id"], config
|
||||||
|
@ -82,7 +82,7 @@ async def test_entry_startup_and_unload(
|
|||||||
[
|
[
|
||||||
InvalidAuth,
|
InvalidAuth,
|
||||||
InvalidFolder,
|
InvalidFolder,
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_entry_startup_fails(
|
async def test_entry_startup_fails(
|
||||||
@ -417,7 +417,7 @@ async def test_late_folder_error(
|
|||||||
"imap_close",
|
"imap_close",
|
||||||
[
|
[
|
||||||
AsyncMock(side_effect=AioImapException("Something went wrong")),
|
AsyncMock(side_effect=AioImapException("Something went wrong")),
|
||||||
AsyncMock(side_effect=asyncio.TimeoutError),
|
AsyncMock(side_effect=TimeoutError),
|
||||||
],
|
],
|
||||||
ids=["AioImapException", "TimeoutError"],
|
ids=["AioImapException", "TimeoutError"],
|
||||||
)
|
)
|
||||||
@ -460,7 +460,7 @@ async def test_handle_cleanup_exception(
|
|||||||
"imap_wait_server_push_exception",
|
"imap_wait_server_push_exception",
|
||||||
[
|
[
|
||||||
AioImapException("Something went wrong"),
|
AioImapException("Something went wrong"),
|
||||||
asyncio.TimeoutError,
|
TimeoutError,
|
||||||
],
|
],
|
||||||
ids=["AioImapException", "TimeoutError"],
|
ids=["AioImapException", "TimeoutError"],
|
||||||
)
|
)
|
||||||
@ -468,7 +468,7 @@ async def test_lost_connection_with_imap_push(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
mock_imap_protocol: MagicMock,
|
mock_imap_protocol: MagicMock,
|
||||||
imap_wait_server_push_exception: AioImapException | asyncio.TimeoutError,
|
imap_wait_server_push_exception: AioImapException | TimeoutError,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test error handling when the connection is lost."""
|
"""Test error handling when the connection is lost."""
|
||||||
# Mock an error in waiting for a pushed update
|
# Mock an error in waiting for a pushed update
|
||||||
|
Loading…
x
Reference in New Issue
Block a user