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",
"documentation": "https://www.home-assistant.io/integrations/brother",
"codeowners": ["@bieniu"],
"requirements": ["brother==2.0.0"],
"requirements": ["brother==2.1.1"],
"zeroconf": [
{
"type": "_printer._tcp.local.",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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