mirror of
https://github.com/home-assistant/core.git
synced 2026-10-02 19:22:18 +01:00
Enable RUF059 and fix violations (#152071)
This commit is contained in:
1 parent
46c38f185c
commit
e3c0cfd1e2
46 files changed
+125
-122
No files matched your search
@@ -295,7 +295,7 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||
) -> None:
|
||||
"""Play a piece of media."""
|
||||
if heos_source.is_media_uri(media_id):
|
||||
media, data = heos_source.from_media_uri(media_id)
|
||||
media, _data = heos_source.from_media_uri(media_id)
|
||||
if not isinstance(media, MediaItem):
|
||||
raise ValueError(f"Invalid media id '{media_id}'")
|
||||
await self._player.play_media(
|
||||
@@ -610,7 +610,7 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||
|
||||
async def _async_browse_heos_media(self, media_content_id: str) -> BrowseMedia:
|
||||
"""Browse a HEOS media item."""
|
||||
media, data = heos_source.from_media_uri(media_content_id)
|
||||
media, _data = heos_source.from_media_uri(media_content_id)
|
||||
browse_media = _media_to_browse_media(media)
|
||||
try:
|
||||
browse_result = await self.coordinator.heos.browse_media(media)
|
||||
|
||||
@@ -148,7 +148,7 @@ class HusqvarnaAutomowerBleConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
assert self.address
|
||||
|
||||
try:
|
||||
(manufacturer, device_type, model) = await Mower(
|
||||
(manufacturer, device_type, _model) = await Mower(
|
||||
channel_id, self.address
|
||||
).probe_gatts(device)
|
||||
except (BleakError, TimeoutError) as exception:
|
||||
|
||||
@@ -53,7 +53,7 @@ class LightwaveBattery(SensorEntity):
|
||||
|
||||
def update(self) -> None:
|
||||
"""Communicate with a Lightwave RTF Proxy to get state."""
|
||||
(dummy_temp, dummy_targ, battery, dummy_output) = self._lwlink.read_trv_status(
|
||||
self._serial
|
||||
(_dummy_temp, _dummy_targ, battery, _dummy_output) = (
|
||||
self._lwlink.read_trv_status(self._serial)
|
||||
)
|
||||
self._attr_native_value = battery
|
||||
@@ -215,12 +215,12 @@ class LovelaceYAML(LovelaceConfig):
|
||||
|
||||
async def async_load(self, force: bool) -> dict[str, Any]:
|
||||
"""Load config."""
|
||||
config, json = await self._async_load_or_cached(force)
|
||||
config, _json = await self._async_load_or_cached(force)
|
||||
return config
|
||||
|
||||
async def async_json(self, force: bool) -> json_fragment:
|
||||
"""Return JSON representation of the config."""
|
||||
config, json = await self._async_load_or_cached(force)
|
||||
_config, json = await self._async_load_or_cached(force)
|
||||
return json
|
||||
|
||||
async def _async_load_or_cached(
|
||||
|
||||
@@ -322,7 +322,7 @@ async def async_remove_config_entry_device(
|
||||
) -> bool:
|
||||
"""Remove a device from a config entry."""
|
||||
host: ReolinkHost = config_entry.runtime_data.host
|
||||
(device_uid, ch, is_chime) = get_device_uid_and_ch(device, host)
|
||||
(_device_uid, ch, is_chime) = get_device_uid_and_ch(device, host)
|
||||
|
||||
if is_chime:
|
||||
await host.api.get_state(cmd="GetDingDongList")
|
||||
@@ -431,7 +431,9 @@ def migrate_entity_ids(
|
||||
if (DOMAIN, host.unique_id) in device.identifiers:
|
||||
remove_ids = True # NVR/Hub in identifiers, keep that one, remove others
|
||||
for old_id in device.identifiers:
|
||||
(old_device_uid, old_ch, old_is_chime) = get_device_uid_and_ch(old_id, host)
|
||||
(old_device_uid, _old_ch, _old_is_chime) = get_device_uid_and_ch(
|
||||
old_id, host
|
||||
)
|
||||
if (
|
||||
not old_device_uid
|
||||
or old_device_uid[0] != host.unique_id
|
||||
|
||||
@@ -46,7 +46,7 @@ async def _async_play_chime(service_call: ServiceCall) -> None:
|
||||
translation_placeholders={"service_name": "play_chime"},
|
||||
)
|
||||
host: ReolinkHost = config_entry.runtime_data.host
|
||||
(device_uid, chime_id, is_chime) = get_device_uid_and_ch(device, host)
|
||||
(_device_uid, chime_id, is_chime) = get_device_uid_and_ch(device, host)
|
||||
chime: Chime | None = host.api.chime(chime_id)
|
||||
if not is_chime or chime is None:
|
||||
raise ServiceValidationError(
|
||||
|
||||
@@ -79,7 +79,7 @@ class PlaybackProxyView(HomeAssistantView):
|
||||
return web.Response(body=err_str, status=HTTPStatus.BAD_REQUEST)
|
||||
|
||||
try:
|
||||
mime_type, reolink_url = await host.api.get_vod_source(
|
||||
_mime_type, reolink_url = await host.api.get_vod_source(
|
||||
ch, filename_decoded, stream_res, VodRequestType(vod_type)
|
||||
)
|
||||
except ReolinkError as err:
|
||||
|
||||
@@ -151,7 +151,7 @@ class SmaConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
errors: dict[str, str] = {}
|
||||
if user_input is not None:
|
||||
reauth_entry = self._get_reauth_entry()
|
||||
errors, device_info = await self._handle_user_input(
|
||||
errors, _device_info = await self._handle_user_input(
|
||||
user_input={
|
||||
**reauth_entry.data,
|
||||
CONF_PASSWORD: user_input[CONF_PASSWORD],
|
||||
@@ -224,7 +224,7 @@ class SmaConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"""Confirm discovery."""
|
||||
errors: dict[str, str] = {}
|
||||
if user_input is not None:
|
||||
errors, device_info = await self._handle_user_input(
|
||||
errors, _device_info = await self._handle_user_input(
|
||||
user_input=user_input, discovery=True
|
||||
)
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
time: int | None = None
|
||||
# Convert time to minutes since minute
|
||||
if "time" in call.data:
|
||||
(hours, minutes, *seconds) = call.data["time"].split(":")
|
||||
(hours, minutes, *_seconds) = call.data["time"].split(":")
|
||||
time = int(hours) * 60 + int(minutes)
|
||||
elif call.data["enable"]:
|
||||
raise ServiceValidationError(
|
||||
@@ -191,7 +191,7 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
)
|
||||
departure_time: int | None = None
|
||||
if ATTR_DEPARTURE_TIME in call.data:
|
||||
(hours, minutes, *seconds) = call.data[ATTR_DEPARTURE_TIME].split(":")
|
||||
(hours, minutes, *_seconds) = call.data[ATTR_DEPARTURE_TIME].split(":")
|
||||
departure_time = int(hours) * 60 + int(minutes)
|
||||
elif preconditioning_enabled:
|
||||
raise ServiceValidationError(
|
||||
@@ -207,7 +207,7 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
end_off_peak_time: int | None = None
|
||||
|
||||
if ATTR_END_OFF_PEAK_TIME in call.data:
|
||||
(hours, minutes, *seconds) = call.data[ATTR_END_OFF_PEAK_TIME].split(":")
|
||||
(hours, minutes, *_seconds) = call.data[ATTR_END_OFF_PEAK_TIME].split(":")
|
||||
end_off_peak_time = int(hours) * 60 + int(minutes)
|
||||
elif off_peak_charging_enabled:
|
||||
raise ServiceValidationError(
|
||||
|
||||
@@ -707,6 +707,7 @@ select = [
|
||||
"RUF032", # Decimal() called with float literal argument
|
||||
"RUF033", # __post_init__ method with argument defaults
|
||||
"RUF034", # Useless if-else condition
|
||||
"RUF059", # unused-unpacked-variable
|
||||
"RUF100", # Unused `noqa` directive
|
||||
"RUF101", # noqa directives that use redirected rule codes
|
||||
"RUF200", # Failed to parse pyproject.toml: {message}
|
||||
|
||||
@@ -383,7 +383,7 @@ async def test_api_remote_set_power_state(
|
||||
},
|
||||
)
|
||||
|
||||
_, msg = await assert_request_calls_service(
|
||||
_, _msg = await assert_request_calls_service(
|
||||
"Alexa.PowerController",
|
||||
target_name,
|
||||
"remote#test",
|
||||
|
||||
@@ -1815,7 +1815,7 @@ async def test_media_player_seek_error(hass: HomeAssistant) -> None:
|
||||
|
||||
# Test for media_position error.
|
||||
with pytest.raises(AssertionError):
|
||||
_, msg = await assert_request_calls_service(
|
||||
_, _msg = await assert_request_calls_service(
|
||||
"Alexa.SeekController",
|
||||
"AdjustSeekPosition",
|
||||
"media_player#test_seek",
|
||||
@@ -2374,7 +2374,7 @@ async def test_cover_position_range(
|
||||
"range": {"minimumValue": 1, "maximumValue": 100},
|
||||
} in position_state_mappings
|
||||
|
||||
call, msg = await assert_request_calls_service(
|
||||
_call, msg = await assert_request_calls_service(
|
||||
"Alexa.RangeController",
|
||||
"AdjustRangeValue",
|
||||
"cover#test_range",
|
||||
|
||||
@@ -717,7 +717,7 @@ async def test_total_increasing_reset(hass: HomeAssistant) -> None:
|
||||
expected_times = [0, 20, 30, 35, 50, 60]
|
||||
expected_values = ["0.00", "0.50", "2.00", "2.00", "1.00", "3.00"]
|
||||
|
||||
config, entity_id = await _setup_sensor(hass, {"unit_time": UnitOfTime.SECONDS})
|
||||
_config, entity_id = await _setup_sensor(hass, {"unit_time": UnitOfTime.SECONDS})
|
||||
|
||||
base_time = dt_util.utcnow()
|
||||
actual_times = []
|
||||
|
||||
@@ -85,7 +85,7 @@ async def test_setup_network_rfxtrx(
|
||||
],
|
||||
) -> None:
|
||||
"""Test we can setup network."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||
(_connection_factory, _transport, protocol) = dsmr_connection_send_validate_fixture
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
@@ -245,7 +245,7 @@ async def test_setup_serial_rfxtrx(
|
||||
],
|
||||
) -> None:
|
||||
"""Test we can setup serial."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||
(_connection_factory, _transport, protocol) = dsmr_connection_send_validate_fixture
|
||||
|
||||
port = com_port()
|
||||
|
||||
@@ -344,7 +344,7 @@ async def test_setup_serial_fail(
|
||||
dsmr_connection_send_validate_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||
) -> None:
|
||||
"""Test failed serial connection."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||
(_connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||
|
||||
port = com_port()
|
||||
|
||||
@@ -395,10 +395,10 @@ async def test_setup_serial_timeout(
|
||||
],
|
||||
) -> None:
|
||||
"""Test failed serial connection."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||
(_connection_factory, _transport, protocol) = dsmr_connection_send_validate_fixture
|
||||
(
|
||||
connection_factory,
|
||||
transport,
|
||||
_connection_factory,
|
||||
_transport,
|
||||
rfxtrx_protocol,
|
||||
) = rfxtrx_dsmr_connection_send_validate_fixture
|
||||
|
||||
@@ -453,10 +453,10 @@ async def test_setup_serial_wrong_telegram(
|
||||
],
|
||||
) -> None:
|
||||
"""Test failed telegram data."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture
|
||||
(_connection_factory, _transport, protocol) = dsmr_connection_send_validate_fixture
|
||||
(
|
||||
rfxtrx_connection_factory,
|
||||
transport,
|
||||
_rfxtrx_connection_factory,
|
||||
_transport,
|
||||
rfxtrx_protocol,
|
||||
) = rfxtrx_dsmr_connection_send_validate_fixture
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ async def test_diagnostics(
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test diagnostics."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
|
||||
@@ -27,7 +27,7 @@ async def test_migrate_gas_to_mbus(
|
||||
dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||
) -> None:
|
||||
"""Test migration of unique_id."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
mock_entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
@@ -138,7 +138,7 @@ async def test_migrate_hourly_gas_to_mbus(
|
||||
dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||
) -> None:
|
||||
"""Test migration of unique_id."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
mock_entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
@@ -249,7 +249,7 @@ async def test_migrate_gas_with_devid_to_mbus(
|
||||
dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||
) -> None:
|
||||
"""Test migration of unique_id."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
mock_entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
@@ -357,7 +357,7 @@ async def test_migrate_gas_to_mbus_exists(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test migration of unique_id."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
mock_entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
|
||||
@@ -57,7 +57,7 @@ async def test_default_setup(
|
||||
dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||
) -> None:
|
||||
"""Test the default setup."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -205,7 +205,7 @@ async def test_setup_only_energy(
|
||||
dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||
) -> None:
|
||||
"""Test the default setup."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -260,7 +260,7 @@ async def test_v4_meter(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test if v4 meter is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -348,7 +348,7 @@ async def test_v5_meter(
|
||||
state: str,
|
||||
) -> None:
|
||||
"""Test if v5 meter is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -421,7 +421,7 @@ async def test_luxembourg_meter(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test if v5 meter is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -516,7 +516,7 @@ async def test_eonhu_meter(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test if v5 meter is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -586,7 +586,7 @@ async def test_belgian_meter(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test if Belgian meter is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -820,7 +820,7 @@ async def test_belgian_meter_alt(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test if Belgian meter is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -1008,7 +1008,7 @@ async def test_belgian_meter_mbus(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test if Belgian meter is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -1158,7 +1158,7 @@ async def test_belgian_meter_low(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test if Belgian meter is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -1207,7 +1207,7 @@ async def test_swedish_meter(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test if v5 meter is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -1282,7 +1282,7 @@ async def test_easymeter(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test if Q3D meter is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -1360,7 +1360,7 @@ async def test_tcp(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""If proper config provided TCP connection should be made."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"host": "localhost",
|
||||
@@ -1389,7 +1389,7 @@ async def test_rfxtrx_tcp(
|
||||
rfxtrx_dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock],
|
||||
) -> None:
|
||||
"""If proper config provided RFXtrx TCP connection should be made."""
|
||||
(connection_factory, transport, protocol) = rfxtrx_dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = rfxtrx_dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"host": "localhost",
|
||||
@@ -1418,7 +1418,7 @@ async def test_connection_errors_retry(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Connection should be retried on error during setup."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(_connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -1457,7 +1457,7 @@ async def test_reconnect(
|
||||
) -> None:
|
||||
"""If transport disconnects, the connection should be retried."""
|
||||
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -1540,7 +1540,7 @@ async def test_gas_meter_providing_energy_reading(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test that gas providing energy readings use the correct device class."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
@@ -1595,7 +1595,7 @@ async def test_heat_meter_mbus(
|
||||
hass: HomeAssistant, dsmr_connection_fixture: tuple[MagicMock, MagicMock, MagicMock]
|
||||
) -> None:
|
||||
"""Test if heat meter reading is correctly parsed."""
|
||||
(connection_factory, transport, protocol) = dsmr_connection_fixture
|
||||
(connection_factory, _transport, _protocol) = dsmr_connection_fixture
|
||||
|
||||
entry_data = {
|
||||
"port": "/dev/ttyUSB0",
|
||||
|
||||
@@ -139,7 +139,7 @@ async def test_auth_tokens_past(
|
||||
) -> None:
|
||||
"""Test credentials manager when cache contains expired data for this user."""
|
||||
|
||||
dt_dtm, dt_str = dt_pair(dt_util.now() - timedelta(hours=1))
|
||||
_dt_dtm, dt_str = dt_pair(dt_util.now() - timedelta(hours=1))
|
||||
|
||||
# make this access token have expired in the past...
|
||||
test_data = TEST_STORAGE_DATA[idx].copy() # shallow copy is OK here
|
||||
|
||||
@@ -117,7 +117,7 @@ def fake_delay(hass: HomeAssistant, ha_delay: int) -> None:
|
||||
|
||||
def test_name(hass: HomeAssistant, requests_mock: requests_mock.Mocker) -> None:
|
||||
"""Test the name."""
|
||||
api, sensor_dict = setup_api(None, MOCK_DATA, requests_mock)
|
||||
_api, sensor_dict = setup_api(None, MOCK_DATA, requests_mock)
|
||||
for value in sensor_dict.values():
|
||||
sensor = value["sensor"]
|
||||
sensor.platform = MockEntityPlatform(hass)
|
||||
@@ -129,7 +129,7 @@ def test_unit_of_measurement(
|
||||
hass: HomeAssistant, requests_mock: requests_mock.Mocker
|
||||
) -> None:
|
||||
"""Test the unit of measurement."""
|
||||
api, sensor_dict = setup_api(hass, MOCK_DATA, requests_mock)
|
||||
_api, sensor_dict = setup_api(hass, MOCK_DATA, requests_mock)
|
||||
for value in sensor_dict.values():
|
||||
sensor = value["sensor"]
|
||||
assert value["units"] == sensor.unit_of_measurement
|
||||
@@ -137,7 +137,7 @@ def test_unit_of_measurement(
|
||||
|
||||
def test_icon(requests_mock: requests_mock.Mocker) -> None:
|
||||
"""Test the icon."""
|
||||
api, sensor_dict = setup_api(None, MOCK_DATA, requests_mock)
|
||||
_api, sensor_dict = setup_api(None, MOCK_DATA, requests_mock)
|
||||
for value in sensor_dict.values():
|
||||
sensor = value["sensor"]
|
||||
assert value["icon"] == sensor.icon
|
||||
@@ -145,7 +145,7 @@ def test_icon(requests_mock: requests_mock.Mocker) -> None:
|
||||
|
||||
def test_state(hass: HomeAssistant, requests_mock: requests_mock.Mocker) -> None:
|
||||
"""Test the initial state."""
|
||||
api, sensor_dict = setup_api(hass, MOCK_DATA, requests_mock)
|
||||
_api, sensor_dict = setup_api(hass, MOCK_DATA, requests_mock)
|
||||
now = datetime(1970, month=1, day=1)
|
||||
with patch("homeassistant.util.dt.now", return_value=now):
|
||||
for name, value in sensor_dict.items():
|
||||
@@ -166,7 +166,7 @@ def test_update_when_value_is_none(
|
||||
hass: HomeAssistant, requests_mock: requests_mock.Mocker
|
||||
) -> None:
|
||||
"""Test state gets updated to unknown when sensor returns no data."""
|
||||
api, sensor_dict = setup_api(hass, None, requests_mock)
|
||||
_api, sensor_dict = setup_api(hass, None, requests_mock)
|
||||
for value in sensor_dict.values():
|
||||
sensor = value["sensor"]
|
||||
fake_delay(hass, 2)
|
||||
@@ -178,7 +178,7 @@ def test_update_when_value_changed(
|
||||
hass: HomeAssistant, requests_mock: requests_mock.Mocker
|
||||
) -> None:
|
||||
"""Test state gets updated when sensor returns a new status."""
|
||||
api, sensor_dict = setup_api(hass, MOCK_DATA_NEXT, requests_mock)
|
||||
_api, sensor_dict = setup_api(hass, MOCK_DATA_NEXT, requests_mock)
|
||||
now = datetime(1970, month=1, day=1)
|
||||
with patch("homeassistant.util.dt.now", return_value=now):
|
||||
for name, value in sensor_dict.items():
|
||||
@@ -203,7 +203,7 @@ def test_when_api_data_missing(
|
||||
hass: HomeAssistant, requests_mock: requests_mock.Mocker
|
||||
) -> None:
|
||||
"""Test state logs an error when data is missing."""
|
||||
api, sensor_dict = setup_api(hass, MOCK_DATA_MISSING, requests_mock)
|
||||
_api, sensor_dict = setup_api(hass, MOCK_DATA_MISSING, requests_mock)
|
||||
now = datetime(1970, month=1, day=1)
|
||||
with patch("homeassistant.util.dt.now", return_value=now):
|
||||
for value in sensor_dict.values():
|
||||
@@ -232,6 +232,6 @@ def update_side_effect(
|
||||
hass: HomeAssistant, requests_mock: requests_mock.Mocker
|
||||
) -> None:
|
||||
"""Mock representation of update function."""
|
||||
api, sensor_dict = setup_api(hass, MOCK_DATA, requests_mock)
|
||||
api, _sensor_dict = setup_api(hass, MOCK_DATA, requests_mock)
|
||||
api.data = None
|
||||
api.available = False
|
||||
@@ -17,7 +17,7 @@ from ..common import (
|
||||
async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
||||
"""Test that the accessory can be correctly setup in HA."""
|
||||
accessories = await setup_accessories_from_file(hass, "connectsense.json")
|
||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||
config_entry, _pairing = await setup_test_accessories(hass, accessories)
|
||||
|
||||
await assert_devices_and_entities_created(
|
||||
hass,
|
||||
|
||||
@@ -190,7 +190,7 @@ async def test_ecobee3_setup_connection_failure(
|
||||
|
||||
# If there is no cached entity map and the accessory connection is
|
||||
# failing then we have to fail the config entry setup.
|
||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||
config_entry, _pairing = await setup_test_accessories(hass, accessories)
|
||||
assert config_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
climate = entity_registry.async_get("climate.homew")
|
||||
|
||||
@@ -38,7 +38,7 @@ async def test_hmip_home_cloud_connection_sensor(
|
||||
test_devices=[entity_name]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
|
||||
@@ -490,7 +490,7 @@ async def test_hmip_heating_profile_name_not_in_list(
|
||||
test_devices=["Heizkörperthermostat2"],
|
||||
test_groups=[entity_name],
|
||||
)
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
|
||||
@@ -280,7 +280,7 @@ async def test_hmip_multi_area_device(
|
||||
test_devices=["Wired Eingangsmodul – 32-fach"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
assert ha_state
|
||||
|
||||
@@ -241,7 +241,7 @@ async def test_hmip_notification_light_2_turn_off(
|
||||
device_model = "HmIP-BSL"
|
||||
mock_hap = await default_mock_hap_factory.async_get_mock_hap(test_devices=["BSL2"])
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
_ha_state, hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
|
||||
@@ -565,7 +565,7 @@ async def test_hmip_esi_iec_current_power_consumption(
|
||||
test_devices=["esi_iec"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -583,7 +583,7 @@ async def test_hmip_esi_iec_energy_counter_usage_high_tariff(
|
||||
test_devices=["esi_iec"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -601,7 +601,7 @@ async def test_hmip_esi_iec_energy_counter_usage_low_tariff(
|
||||
test_devices=["esi_iec"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -619,7 +619,7 @@ async def test_hmip_esi_iec_energy_counter_input_single_tariff(
|
||||
test_devices=["esi_iec"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -652,7 +652,7 @@ async def test_hmip_esi_gas_current_gas_flow(
|
||||
test_devices=["esi_gas"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -670,7 +670,7 @@ async def test_hmip_esi_gas_gas_volume(
|
||||
test_devices=["esi_gas"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -688,7 +688,7 @@ async def test_hmip_esi_led_current_power_consumption(
|
||||
test_devices=["esi_led"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -706,7 +706,7 @@ async def test_hmip_esi_led_energy_counter_usage_high_tariff(
|
||||
test_devices=["esi_led"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -754,7 +754,7 @@ async def test_hmip_tilt_vibration_sensor_tilt_angle(
|
||||
test_devices=["Neigungssensor Tor"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -772,7 +772,7 @@ async def test_hmip_absolute_humidity_sensor(
|
||||
test_devices=["elvshctv"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -811,7 +811,7 @@ async def test_hmip_water_valve_current_water_flow(
|
||||
test_devices=["Bewaesserungsaktor"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -834,7 +834,7 @@ async def test_hmip_water_valve_water_volume(
|
||||
test_devices=["Bewaesserungsaktor"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
@@ -854,7 +854,7 @@ async def test_hmip_water_valve_water_volume_since_open(
|
||||
test_devices=["Bewaesserungsaktor"]
|
||||
)
|
||||
|
||||
ha_state, hmip_device = get_and_check_entity_basics(
|
||||
ha_state, _hmip_device = get_and_check_entity_basics(
|
||||
hass, mock_hap, entity_id, entity_name, device_model
|
||||
)
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ async def test_get_modem_schema_hub(
|
||||
) -> None:
|
||||
"""Test getting the Insteon PLM modem configuration schema."""
|
||||
|
||||
ws_client, devices, _, _ = await async_mock_setup(
|
||||
ws_client, _devices, _, _ = await async_mock_setup(
|
||||
hass,
|
||||
hass_ws_client,
|
||||
config_data={**MOCK_USER_INPUT_HUB_V2, CONF_HUB_VERSION: 2},
|
||||
|
||||
@@ -494,7 +494,7 @@ async def test_bad_address(
|
||||
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, kpl_properties_data
|
||||
) -> None:
|
||||
"""Test for a bad Insteon address."""
|
||||
ws_client, devices = await _setup(
|
||||
ws_client, _devices = await _setup(
|
||||
hass, hass_ws_client, "33.33.33", kpl_properties_data
|
||||
)
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ async def test_failed_connection_plm_manually(hass: HomeAssistant) -> None:
|
||||
|
||||
result = await _init_form(hass, STEP_PLM)
|
||||
|
||||
result2, _ = await _device_form(
|
||||
_result2, _ = await _device_form(
|
||||
hass, result["flow_id"], mock_successful_connection, MOCK_USER_INPUT_PLM_MANUAL
|
||||
)
|
||||
result3, _ = await _device_form(
|
||||
|
||||
@@ -79,7 +79,7 @@ async def test_standard_config_with_single_fireplace_and_bad_credentials(
|
||||
mock_apis_single_fp,
|
||||
) -> None:
|
||||
"""Test bad credentials on a login."""
|
||||
mock_local_interface, mock_cloud_interface, mock_fp = mock_apis_single_fp
|
||||
_mock_local_interface, mock_cloud_interface, _mock_fp = mock_apis_single_fp
|
||||
# Set login error
|
||||
mock_cloud_interface.login_with_credentials.side_effect = LoginError
|
||||
|
||||
@@ -190,7 +190,7 @@ async def test_dhcp_discovery_non_intellifire_device(
|
||||
"""Test successful DHCP Discovery of a non intellifire device.."""
|
||||
|
||||
# Patch poll with an exception
|
||||
mock_local_interface, mock_cloud_interface, mock_fp = mock_apis_multifp
|
||||
mock_local_interface, _mock_cloud_interface, _mock_fp = mock_apis_multifp
|
||||
mock_local_interface.poll.side_effect = ConnectionError
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
||||
@@ -71,9 +71,9 @@ async def test_auth(
|
||||
# Verify API requests are made with the correct credentials
|
||||
calls = aioclient_mock.mock_calls
|
||||
assert len(calls) == 2
|
||||
(method, url, data, headers) = calls[0]
|
||||
(_method, _url, _data, headers) = calls[0]
|
||||
assert headers == {"Authorization": f"Bearer {FAKE_TOKEN}"}
|
||||
(method, url, data, headers) = calls[1]
|
||||
(_method, _url, _data, headers) = calls[1]
|
||||
assert headers == {"Authorization": f"Bearer {FAKE_TOKEN}"}
|
||||
|
||||
# Verify the subscriber was created with the correct credentials
|
||||
|
||||
@@ -124,7 +124,7 @@ async def test_active_accessory(
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test climate groups that can be deactivated by configuration."""
|
||||
climate, unit = _setup_climate_group(coils, model, climate_id)
|
||||
climate, _unit = _setup_climate_group(coils, model, climate_id)
|
||||
|
||||
await async_add_model(hass, model)
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ async def test_set_dateandtime_button(
|
||||
|
||||
async def test_set_dateandtime_button_press(hass: HomeAssistant) -> None:
|
||||
"""Test SetDateAndTime button press."""
|
||||
_, camera, device = await setup_onvif_integration(hass)
|
||||
_, _camera, device = await setup_onvif_integration(hass)
|
||||
device.async_manually_set_date_and_time = AsyncMock(return_value=True)
|
||||
|
||||
await hass.services.async_call(
|
||||
|
||||
@@ -541,7 +541,7 @@ async def test_rest_data_boolean_params_converted_to_strings(
|
||||
|
||||
# Check that the request was made with boolean values converted to strings
|
||||
assert len(aioclient_mock.mock_calls) == 1
|
||||
method, url, data, headers = aioclient_mock.mock_calls[0]
|
||||
_method, url, _data, _headers = aioclient_mock.mock_calls[0]
|
||||
|
||||
# Check that the URL query parameters have boolean values converted to strings
|
||||
assert url.query["boolTrue"] == "true"
|
||||
|
||||
@@ -1164,7 +1164,7 @@ async def test_query_param_json_string_preserved(
|
||||
|
||||
# Verify the request was made with the JSON string intact
|
||||
assert len(aioclient_mock.mock_calls) == 1
|
||||
method, url, data, headers = aioclient_mock.mock_calls[0]
|
||||
_method, url, _data, _headers = aioclient_mock.mock_calls[0]
|
||||
assert url.query["filter"] == '{"type": "sensor", "id": 123}'
|
||||
assert url.query["normal"] == "value"
|
||||
|
||||
|
||||
@@ -547,7 +547,7 @@ async def test_unique_id(
|
||||
}
|
||||
|
||||
# setup mocking rflink module
|
||||
event_callback, _, _, _ = await mock_rflink(hass, config, DOMAIN, monkeypatch)
|
||||
_event_callback, _, _, _ = await mock_rflink(hass, config, DOMAIN, monkeypatch)
|
||||
|
||||
humidity_entry = entity_registry.async_get("sensor.humidity_device")
|
||||
assert humidity_entry
|
||||
@@ -569,7 +569,7 @@ async def test_enable_debug_logs(
|
||||
config = {DOMAIN: {CONF_HOST: "10.10.0.1", CONF_PORT: 1234}}
|
||||
|
||||
# setup mocking rflink module
|
||||
_, mock_create, _, _ = await mock_rflink(hass, config, domain, monkeypatch)
|
||||
_, _mock_create, _, _ = await mock_rflink(hass, config, domain, monkeypatch)
|
||||
|
||||
logging.getLogger("rflink").setLevel(logging.DEBUG)
|
||||
hass.bus.async_fire(EVENT_LOGGING_CHANGED)
|
||||
|
||||
@@ -287,7 +287,7 @@ async def test_sensor_attributes(
|
||||
}
|
||||
|
||||
# setup mocking rflink module
|
||||
event_callback, _, _, _ = await mock_rflink(hass, config, DOMAIN, monkeypatch)
|
||||
_event_callback, _, _, _ = await mock_rflink(hass, config, DOMAIN, monkeypatch)
|
||||
|
||||
# test sensor loaded from config
|
||||
meter_state = hass.states.get("sensor.meter_device")
|
||||
|
||||
@@ -654,14 +654,14 @@ async def test_shared_context(hass: HomeAssistant) -> None:
|
||||
assert event_mock.call_count == 1
|
||||
assert run_mock.call_count == 1
|
||||
|
||||
args, kwargs = run_mock.call_args
|
||||
args, _kwargs = run_mock.call_args
|
||||
assert args[0].context == context
|
||||
# Ensure event data has all attributes set
|
||||
assert args[0].data.get(ATTR_NAME) == "test"
|
||||
assert args[0].data.get(ATTR_ENTITY_ID) == "script.test"
|
||||
|
||||
# Ensure context carries through the event
|
||||
args, kwargs = event_mock.call_args
|
||||
args, _kwargs = event_mock.call_args
|
||||
assert args[0].context == context
|
||||
|
||||
# Ensure the script state shares the same context
|
||||
|
||||
@@ -1967,7 +1967,7 @@ async def test_compile_hourly_sum_statistics_total_no_reset(
|
||||
}
|
||||
seq = [10, 15, 20, 10, 30, 40, 50, 60, 70]
|
||||
with freeze_time(period0) as freezer:
|
||||
four, eight, states = await async_record_meter_states(
|
||||
_four, eight, states = await async_record_meter_states(
|
||||
hass, freezer, period0, "sensor.test1", attributes, seq
|
||||
)
|
||||
await async_wait_recording_done(hass)
|
||||
@@ -2081,7 +2081,7 @@ async def test_compile_hourly_sum_statistics_total_increasing(
|
||||
}
|
||||
seq = [10, 15, 20, 10, 30, 40, 50, 60, 70]
|
||||
with freeze_time(period0) as freezer:
|
||||
four, eight, states = await async_record_meter_states(
|
||||
_four, eight, states = await async_record_meter_states(
|
||||
hass, freezer, period0, "sensor.test1", attributes, seq
|
||||
)
|
||||
await async_wait_recording_done(hass)
|
||||
@@ -2195,7 +2195,7 @@ async def test_compile_hourly_sum_statistics_total_increasing_small_dip(
|
||||
}
|
||||
seq = [10, 15, 20, 19, 30, 40, 39, 60, 70]
|
||||
with freeze_time(period0) as freezer:
|
||||
four, eight, states = await async_record_meter_states(
|
||||
_four, eight, states = await async_record_meter_states(
|
||||
hass, freezer, period0, "sensor.test1", attributes, seq
|
||||
)
|
||||
await async_wait_recording_done(hass)
|
||||
|
||||
@@ -174,7 +174,7 @@ def test_sending_insecure_files_fails(
|
||||
patch("email.utils.make_msgid", return_value=sample_email),
|
||||
pytest.raises(ServiceValidationError) as exc,
|
||||
):
|
||||
result, _ = message.send_message(message_data, data=data)
|
||||
_result, _ = message.send_message(message_data, data=data)
|
||||
assert exc.value.translation_key == "remote_path_not_allowed"
|
||||
assert exc.value.translation_domain == DOMAIN
|
||||
assert (
|
||||
|
||||
@@ -74,7 +74,7 @@ async def test_text_camera_set(
|
||||
assert_entity_counts(hass, Platform.TEXT, 1, 1)
|
||||
|
||||
description = CAMERA[0]
|
||||
unique_id, entity_id = await ids_from_device_description(
|
||||
_unique_id, entity_id = await ids_from_device_description(
|
||||
hass, Platform.TEXT, doorbell, description
|
||||
)
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ from tests.typing import WebSocketGenerator
|
||||
async def test_yale_api_is_failing(hass: HomeAssistant) -> None:
|
||||
"""Config entry state is SETUP_RETRY when yale api is failing."""
|
||||
|
||||
config_entry, socketio = await _create_yale_with_devices(
|
||||
config_entry, _socketio = await _create_yale_with_devices(
|
||||
hass,
|
||||
authenticate_side_effect=YaleApiError(
|
||||
"offline", ClientResponseError(None, None, status=500)
|
||||
@@ -48,7 +48,7 @@ async def test_yale_api_is_failing(hass: HomeAssistant) -> None:
|
||||
async def test_yale_is_offline(hass: HomeAssistant) -> None:
|
||||
"""Config entry state is SETUP_RETRY when yale is offline."""
|
||||
|
||||
config_entry, socketio = await _create_yale_with_devices(
|
||||
config_entry, _socketio = await _create_yale_with_devices(
|
||||
hass, authenticate_side_effect=TimeoutError
|
||||
)
|
||||
|
||||
@@ -57,7 +57,7 @@ async def test_yale_is_offline(hass: HomeAssistant) -> None:
|
||||
|
||||
async def test_yale_late_auth_failure(hass: HomeAssistant) -> None:
|
||||
"""Test we can detect a late auth failure."""
|
||||
config_entry, socketio = await _create_yale_with_devices(
|
||||
config_entry, _socketio = await _create_yale_with_devices(
|
||||
hass,
|
||||
authenticate_side_effect=InvalidAuth(
|
||||
"authfailed", ClientResponseError(None, None, status=401)
|
||||
@@ -174,7 +174,7 @@ async def test_load_unload(hass: HomeAssistant) -> None:
|
||||
|
||||
yale_operative_lock = await _mock_operative_yale_lock_detail(hass)
|
||||
yale_inoperative_lock = await _mock_inoperative_yale_lock_detail(hass)
|
||||
config_entry, socketio = await _create_yale_with_devices(
|
||||
config_entry, _socketio = await _create_yale_with_devices(
|
||||
hass, [yale_operative_lock, yale_inoperative_lock]
|
||||
)
|
||||
|
||||
@@ -193,7 +193,7 @@ async def test_load_triggers_ble_discovery(
|
||||
yale_lock_with_key = await _mock_lock_with_offline_key(hass)
|
||||
yale_lock_without_key = await _mock_operative_yale_lock_detail(hass)
|
||||
|
||||
config_entry, socketio = await _create_yale_with_devices(
|
||||
config_entry, _socketio = await _create_yale_with_devices(
|
||||
hass, [yale_lock_with_key, yale_lock_without_key]
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
@@ -218,7 +218,7 @@ async def test_device_remove_devices(
|
||||
"""Test we can only remove a device that no longer exists."""
|
||||
assert await async_setup_component(hass, "config", {})
|
||||
yale_operative_lock = await _mock_operative_yale_lock_detail(hass)
|
||||
config_entry, socketio = await _create_yale_with_devices(
|
||||
config_entry, _socketio = await _create_yale_with_devices(
|
||||
hass, [yale_operative_lock]
|
||||
)
|
||||
entity = entity_registry.entities["lock.a6697750d607098bae8d6baa11ef8063_name"]
|
||||
|
||||
@@ -1149,7 +1149,7 @@ async def test_strategy_no_network_settings(
|
||||
"""Test formation strategy when no network settings are present."""
|
||||
mock_app.load_network_info = MagicMock(side_effect=NetworkNotFormed())
|
||||
|
||||
result, port = await pick_radio(RadioType.ezsp)
|
||||
result, _port = await pick_radio(RadioType.ezsp)
|
||||
assert (
|
||||
config_flow.FORMATION_REUSE_SETTINGS
|
||||
not in result["data_schema"].schema["next_step_id"].container
|
||||
@@ -1160,7 +1160,7 @@ async def test_formation_strategy_form_new_network(
|
||||
pick_radio: RadioPicker, mock_app: AsyncMock, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test forming a new network."""
|
||||
result, port = await pick_radio(RadioType.ezsp)
|
||||
result, _port = await pick_radio(RadioType.ezsp)
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -1180,7 +1180,7 @@ async def test_formation_strategy_form_initial_network(
|
||||
"""Test forming a new network, with no previous settings on the radio."""
|
||||
mock_app.load_network_info = AsyncMock(side_effect=NetworkNotFormed())
|
||||
|
||||
result, port = await pick_radio(RadioType.ezsp)
|
||||
result, _port = await pick_radio(RadioType.ezsp)
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={"next_step_id": config_flow.FORMATION_FORM_INITIAL_NETWORK},
|
||||
@@ -1234,7 +1234,7 @@ async def test_formation_strategy_reuse_settings(
|
||||
pick_radio: RadioPicker, mock_app: AsyncMock, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test reusing existing network settings."""
|
||||
result, port = await pick_radio(RadioType.ezsp)
|
||||
result, _port = await pick_radio(RadioType.ezsp)
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -1270,7 +1270,7 @@ async def test_formation_strategy_restore_manual_backup_non_ezsp(
|
||||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""Test restoring a manual backup on non-EZSP coordinators."""
|
||||
result, port = await pick_radio(RadioType.znp)
|
||||
result, _port = await pick_radio(RadioType.znp)
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -1306,7 +1306,7 @@ async def test_formation_strategy_restore_manual_backup_overwrite_ieee_ezsp(
|
||||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""Test restoring a manual backup on EZSP coordinators (overwrite IEEE)."""
|
||||
result, port = await pick_radio(RadioType.ezsp)
|
||||
result, _port = await pick_radio(RadioType.ezsp)
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -1349,7 +1349,7 @@ async def test_formation_strategy_restore_manual_backup_ezsp(
|
||||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""Test restoring a manual backup on EZSP coordinators (don't overwrite IEEE)."""
|
||||
result, port = await pick_radio(RadioType.ezsp)
|
||||
result, _port = await pick_radio(RadioType.ezsp)
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -1390,7 +1390,7 @@ async def test_formation_strategy_restore_manual_backup_invalid_upload(
|
||||
pick_radio: RadioPicker, mock_app: AsyncMock, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test restoring a manual backup but an invalid file is uploaded."""
|
||||
result, port = await pick_radio(RadioType.ezsp)
|
||||
result, _port = await pick_radio(RadioType.ezsp)
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -1450,7 +1450,7 @@ async def test_formation_strategy_restore_automatic_backup_ezsp(
|
||||
backup = mock_app.backups.backups[1] # pick the second one
|
||||
backup.is_compatible_with = MagicMock(return_value=False)
|
||||
|
||||
result, port = await pick_radio(RadioType.ezsp)
|
||||
result, _port = await pick_radio(RadioType.ezsp)
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={"next_step_id": (config_flow.FORMATION_CHOOSE_AUTOMATIC_BACKUP)},
|
||||
@@ -1503,7 +1503,7 @@ async def test_formation_strategy_restore_automatic_backup_non_ezsp(
|
||||
backup = mock_app.backups.backups[1] # pick the second one
|
||||
backup.is_compatible_with = MagicMock(return_value=False)
|
||||
|
||||
result, port = await pick_radio(RadioType.znp)
|
||||
result, _port = await pick_radio(RadioType.znp)
|
||||
|
||||
with patch(
|
||||
"homeassistant.config_entries.ConfigFlow.show_advanced_options",
|
||||
@@ -1556,7 +1556,7 @@ async def test_ezsp_restore_without_settings_change_ieee(
|
||||
with patch.object(
|
||||
mock_app, "load_network_info", MagicMock(side_effect=NetworkNotFormed())
|
||||
):
|
||||
result, port = await pick_radio(RadioType.ezsp)
|
||||
result, _port = await pick_radio(RadioType.ezsp)
|
||||
|
||||
# Set the network state, it'll be picked up later after the load "succeeds"
|
||||
mock_app.state.node_info = backup.node_info
|
||||
|
||||
@@ -165,7 +165,7 @@ async def test_zha_logbook_event_device_no_triggers(
|
||||
) -> None:
|
||||
"""Test ZHA logbook events with device and without triggers."""
|
||||
|
||||
zigpy_device, zha_device = mock_devices
|
||||
_zigpy_device, zha_device = mock_devices
|
||||
ieee_address = str(zha_device.device.ieee)
|
||||
reg_device = device_registry.async_get_device(identifiers={("zha", ieee_address)})
|
||||
|
||||
|
||||
@@ -336,7 +336,7 @@ async def test_firmware_update_success(
|
||||
|
||||
async def endpoint_reply(cluster, sequence, data, **kwargs):
|
||||
if cluster == general.Ota.cluster_id:
|
||||
hdr, cmd = ota_cluster.deserialize(data)
|
||||
_hdr, cmd = ota_cluster.deserialize(data)
|
||||
if isinstance(cmd, general.Ota.ImageNotifyCommand):
|
||||
zha_device.device.device.packet_received(
|
||||
make_packet(
|
||||
@@ -532,7 +532,7 @@ async def test_firmware_update_raises(
|
||||
|
||||
async def endpoint_reply(cluster, sequence, data, **kwargs):
|
||||
if cluster == general.Ota.cluster_id:
|
||||
hdr, cmd = ota_cluster.deserialize(data)
|
||||
_hdr, cmd = ota_cluster.deserialize(data)
|
||||
if isinstance(cmd, general.Ota.ImageNotifyCommand):
|
||||
zha_device.device.device.packet_received(
|
||||
make_packet(
|
||||
|
||||
@@ -4622,7 +4622,7 @@ async def test_flow_same_device_multiple_sources(
|
||||
flow3 = manager.flow.async_init(
|
||||
"comp", context={"source": config_entries.SOURCE_HOMEKIT}
|
||||
)
|
||||
result1, result2, result3 = await asyncio.gather(flow1, flow2, flow3)
|
||||
_result1, result2, _result3 = await asyncio.gather(flow1, flow2, flow3)
|
||||
|
||||
flows = hass.config_entries.flow.async_progress()
|
||||
assert len(flows) == 1
|
||||
|
||||
Reference in new issue
Block a user