Ignore attribute-defined-outside-init pylint warnings in tests (#119470)
This commit is contained in:
parent
2a7e78a80f
commit
7d631c28a6
9 changed files with 13 additions and 0 deletions
|
@ -107,6 +107,7 @@ async def test_wrapped_bleak_client_local_adapter_only(hass: HomeAssistant) -> N
|
|||
"00:00:00:00:00:01",
|
||||
"hci0",
|
||||
)
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
scanner.connectable = True
|
||||
cancel = manager.async_register_scanner(scanner)
|
||||
inject_advertisement_with_source(
|
||||
|
|
|
@ -50,6 +50,7 @@ class FakeHarmonyClient:
|
|||
self, ip_address: str = "", callbacks: ClientCallbackType = MagicMock()
|
||||
):
|
||||
"""Initialize FakeHarmonyClient class to capture callbacks."""
|
||||
# pylint: disable=attribute-defined-outside-init
|
||||
self._activity_name = "Watch TV"
|
||||
self.close = AsyncMock()
|
||||
self.send_commands = AsyncMock()
|
||||
|
|
|
@ -36,6 +36,7 @@ def _mock_cond_socket(sockname):
|
|||
class CondMockSock(MagicMock):
|
||||
def connect(self, addr):
|
||||
"""Mock connect that stores addr."""
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
self._addr = addr[0]
|
||||
|
||||
def getsockname(self):
|
||||
|
|
|
@ -467,6 +467,7 @@ def music_library_fixture(
|
|||
def alarm_clock_fixture():
|
||||
"""Create alarmClock fixture."""
|
||||
alarm_clock = SonosMockService("AlarmClock")
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
alarm_clock.ListAlarms = Mock()
|
||||
alarm_clock.ListAlarms.return_value = {
|
||||
"CurrentAlarmListVersion": "RINCON_test:14",
|
||||
|
@ -484,6 +485,7 @@ def alarm_clock_fixture():
|
|||
def alarm_clock_fixture_extended():
|
||||
"""Create alarmClock fixture."""
|
||||
alarm_clock = SonosMockService("AlarmClock")
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
alarm_clock.ListAlarms = Mock()
|
||||
alarm_clock.ListAlarms.return_value = {
|
||||
"CurrentAlarmListVersion": "RINCON_test:15",
|
||||
|
|
|
@ -132,6 +132,7 @@ class MockAsyncBulb:
|
|||
|
||||
|
||||
def _mocked_bulb(cannot_connect=False):
|
||||
# pylint: disable=attribute-defined-outside-init
|
||||
bulb = MockAsyncBulb(MODEL, BulbType.Color, cannot_connect)
|
||||
type(bulb).async_get_properties = AsyncMock(
|
||||
side_effect=BulbException if cannot_connect else None
|
||||
|
|
|
@ -107,6 +107,7 @@ async def test_async_update_support(hass: HomeAssistant) -> None:
|
|||
"""Async update."""
|
||||
async_update.append(1)
|
||||
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
ent.async_update = async_update_func
|
||||
|
||||
await ent.async_update_ha_state(True)
|
||||
|
|
|
@ -94,8 +94,10 @@ async def test_polling_check_works_if_entity_add_fails(
|
|||
return self.hass.data is not None
|
||||
|
||||
working_poll_ent = MockEntityNeedsSelfHassInShouldPoll(should_poll=True)
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
working_poll_ent.async_update = AsyncMock()
|
||||
broken_poll_ent = MockEntityNeedsSelfHassInShouldPoll(should_poll=True)
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
broken_poll_ent.async_update = AsyncMock(side_effect=Exception("Broken"))
|
||||
|
||||
await component.async_add_entities(
|
||||
|
|
|
@ -68,7 +68,9 @@ def manager_fixture():
|
|||
return result
|
||||
|
||||
mgr = FlowManager(None)
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
mgr.mock_created_entries = entries
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
mgr.mock_reg_handler = handlers.register
|
||||
return mgr
|
||||
|
||||
|
|
|
@ -47,7 +47,9 @@ def manager():
|
|||
return result
|
||||
|
||||
mgr = FlowManager(None)
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
mgr.mock_created_entries = entries
|
||||
# pylint: disable-next=attribute-defined-outside-init
|
||||
mgr.mock_reg_handler = handlers.register
|
||||
return mgr
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue