Bump brother and pysnmplib (#84107)

* Bump brother version

* Bump pysnmplib version

* Update sensor platform

* Update switch platform

* Update tests

* Bump brother

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Maciej Bieniek 2022-12-17 12:34:43 +01:00 committed by GitHub
parent 768d147cb2
commit d9903c4cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 13 deletions

View File

@ -3,7 +3,7 @@
"name": "Brother Printer", "name": "Brother Printer",
"documentation": "https://www.home-assistant.io/integrations/brother", "documentation": "https://www.home-assistant.io/integrations/brother",
"codeowners": ["@bieniu"], "codeowners": ["@bieniu"],
"requirements": ["brother==2.0.0"], "requirements": ["brother==2.1.1"],
"zeroconf": [ "zeroconf": [
{ {
"type": "_printer._tcp.local.", "type": "_printer._tcp.local.",

View File

@ -2,7 +2,7 @@
"domain": "snmp", "domain": "snmp",
"name": "SNMP", "name": "SNMP",
"documentation": "https://www.home-assistant.io/integrations/snmp", "documentation": "https://www.home-assistant.io/integrations/snmp",
"requirements": ["pysnmplib==5.0.15"], "requirements": ["pysnmplib==5.0.20"],
"codeowners": [], "codeowners": [],
"iot_class": "local_polling", "iot_class": "local_polling",
"loggers": ["pyasn1", "pysmi", "pysnmp"] "loggers": ["pyasn1", "pysmi", "pysnmp"]

View File

@ -132,10 +132,8 @@ async def async_setup_platform(
UdpTransportTarget((host, port), timeout=DEFAULT_TIMEOUT), UdpTransportTarget((host, port), timeout=DEFAULT_TIMEOUT),
ContextData(), ContextData(),
] ]
get_result = await getCmd(*request_args, ObjectType(ObjectIdentity(baseoid)))
errindication, _, _, _ = await getCmd( errindication, _, _, _ = await get_result
*request_args, ObjectType(ObjectIdentity(baseoid))
)
if errindication and not accept_errors: if errindication and not accept_errors:
_LOGGER.error("Please check the details in the configuration file") _LOGGER.error("Please check the details in the configuration file")
@ -194,9 +192,10 @@ class SnmpData:
async def async_update(self): async def async_update(self):
"""Get the latest data from the remote SNMP capable host.""" """Get the latest data from the remote SNMP capable host."""
errindication, errstatus, errindex, restable = await getCmd( get_result = await getCmd(
*self._request_args, ObjectType(ObjectIdentity(self._baseoid)) *self._request_args, ObjectType(ObjectIdentity(self._baseoid))
) )
errindication, errstatus, errindex, restable = await get_result
if errindication and not self._accept_errors: if errindication and not self._accept_errors:
_LOGGER.error("SNMP error: %s", errindication) _LOGGER.error("SNMP error: %s", errindication)

View File

@ -259,9 +259,10 @@ class SnmpSwitch(SwitchEntity):
async def async_update(self) -> None: async def async_update(self) -> None:
"""Update the state.""" """Update the state."""
errindication, errstatus, errindex, restable = await getCmd( get_result = await getCmd(
*self._request_args, ObjectType(ObjectIdentity(self._baseoid)) *self._request_args, ObjectType(ObjectIdentity(self._baseoid))
) )
errindication, errstatus, errindex, restable = await get_result
if errindication: if errindication:
_LOGGER.error("SNMP error: %s", errindication) _LOGGER.error("SNMP error: %s", errindication)

View File

@ -476,7 +476,7 @@ boto3==1.20.24
broadlink==0.18.3 broadlink==0.18.3
# homeassistant.components.brother # homeassistant.components.brother
brother==2.0.0 brother==2.1.1
# homeassistant.components.brottsplatskartan # homeassistant.components.brottsplatskartan
brottsplatskartan==0.0.1 brottsplatskartan==0.0.1
@ -1939,7 +1939,7 @@ pysmarty==0.8
pysml==0.0.8 pysml==0.0.8
# homeassistant.components.snmp # homeassistant.components.snmp
pysnmplib==5.0.15 pysnmplib==5.0.20
# homeassistant.components.snooz # homeassistant.components.snooz
pysnooz==0.8.3 pysnooz==0.8.3

View File

@ -386,7 +386,7 @@ boschshcpy==0.2.35
broadlink==0.18.3 broadlink==0.18.3
# homeassistant.components.brother # homeassistant.components.brother
brother==2.0.0 brother==2.1.1
# homeassistant.components.brunt # homeassistant.components.brunt
brunt==1.2.0 brunt==1.2.0
@ -1374,7 +1374,7 @@ pysmartapp==0.3.3
pysmartthings==0.7.6 pysmartthings==0.7.6
# homeassistant.components.snmp # homeassistant.components.snmp
pysnmplib==5.0.15 pysnmplib==5.0.20
# homeassistant.components.snooz # homeassistant.components.snooz
pysnooz==0.8.3 pysnooz==0.8.3

View File

@ -1,5 +1,6 @@
"""SNMP sensor tests.""" """SNMP sensor tests."""
import asyncio
from unittest.mock import MagicMock, Mock, patch from unittest.mock import MagicMock, Mock, patch
import pytest import pytest
@ -15,9 +16,11 @@ def hlapi_mock():
"""Mock out 3rd party API.""" """Mock out 3rd party API."""
mock_data = MagicMock() mock_data = MagicMock()
mock_data.prettyPrint = Mock(return_value="hello") mock_data.prettyPrint = Mock(return_value="hello")
future = asyncio.get_event_loop().create_future()
future.set_result((None, None, None, [[mock_data]]))
with patch( with patch(
"homeassistant.components.snmp.sensor.getCmd", "homeassistant.components.snmp.sensor.getCmd",
return_value=(None, None, None, [[mock_data]]), return_value=future,
): ):
yield yield