1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-22 19:07:08 +00:00
Files
core/homeassistant/components/teslemetry/context.py
Brett Adams b28e8a3cf0 Add tests to Teslemetry (#108884)
* Add tests

* Add partial sleep test

* Remove useless AsyncMock

* Review feedback

* Patch imports

* Fix mock_test
2024-01-28 21:04:44 +01:00

17 lines
389 B
Python

"""Teslemetry context managers."""
from contextlib import contextmanager
from tesla_fleet_api.exceptions import TeslaFleetError
from homeassistant.exceptions import HomeAssistantError
@contextmanager
def handle_command():
"""Handle wake up and errors."""
try:
yield
except TeslaFleetError as e:
raise HomeAssistantError("Teslemetry command failed") from e