Bump brother to 2.2.0 (#88618)

pull/88630/head
Maciej Bieniek 2023-02-22 20:28:58 +01:00 committed by GitHub
parent 205c5ccbf3
commit 64e39c9c81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 12 deletions

View File

@ -5,7 +5,7 @@ from datetime import timedelta
import logging
import async_timeout
from brother import Brother, BrotherSensors, SnmpError, UnsupportedModel
from brother import Brother, BrotherSensors, SnmpError, UnsupportedModelError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_TYPE, Platform
@ -81,6 +81,6 @@ class BrotherDataUpdateCoordinator(DataUpdateCoordinator[BrotherSensors]):
try:
async with async_timeout.timeout(20):
data = await self.brother.async_update()
except (ConnectionError, SnmpError, UnsupportedModel) as error:
except (ConnectionError, SnmpError, UnsupportedModelError) as error:
raise UpdateFailed(error) from error
return data

View File

@ -3,7 +3,7 @@ from __future__ import annotations
from typing import Any
from brother import Brother, SnmpError, UnsupportedModel
from brother import Brother, SnmpError, UnsupportedModelError
import voluptuous as vol
from homeassistant import config_entries, exceptions
@ -62,7 +62,7 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
errors["base"] = "cannot_connect"
except SnmpError:
errors["base"] = "snmp_error"
except UnsupportedModel:
except UnsupportedModelError:
return self.async_abort(reason="unsupported_model")
return self.async_show_form(
@ -86,7 +86,7 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
self.host, snmp_engine=snmp_engine, model=model
)
await self.brother.async_update()
except UnsupportedModel:
except UnsupportedModelError:
return self.async_abort(reason="unsupported_model")
except (ConnectionError, SnmpError):
return self.async_abort(reason="cannot_connect")

View File

@ -8,7 +8,7 @@
"iot_class": "local_polling",
"loggers": ["brother", "pyasn1", "pysmi", "pysnmp"],
"quality_scale": "platinum",
"requirements": ["brother==2.1.1"],
"requirements": ["brother==2.2.0"],
"zeroconf": [
{
"type": "_printer._tcp.local.",

View File

@ -480,7 +480,7 @@ boto3==1.20.24
broadlink==0.18.3
# homeassistant.components.brother
brother==2.1.1
brother==2.2.0
# homeassistant.components.brottsplatskartan
brottsplatskartan==0.0.1

View File

@ -393,7 +393,7 @@ boschshcpy==0.2.35
broadlink==0.18.3
# homeassistant.components.brother
brother==2.1.1
brother==2.2.0
# homeassistant.components.brunt
brunt==1.2.0

View File

@ -2,7 +2,7 @@
import json
from unittest.mock import patch
from brother import SnmpError, UnsupportedModel
from brother import SnmpError, UnsupportedModelError
from homeassistant import data_entry_flow
from homeassistant.components import zeroconf
@ -116,7 +116,7 @@ async def test_snmp_error(hass: HomeAssistant) -> None:
async def test_unsupported_model_error(hass: HomeAssistant) -> None:
"""Test unsupported printer model error."""
with patch("brother.Brother.initialize"), patch(
"brother.Brother._get_data", side_effect=UnsupportedModel("error")
"brother.Brother._get_data", side_effect=UnsupportedModelError("error")
):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG

View File

@ -22,7 +22,7 @@ async def test_entry_diagnostics(
diagnostics_data = json.loads(load_fixture("diagnostics_data.json", "brother"))
test_time = datetime(2019, 11, 11, 9, 10, 32, tzinfo=UTC)
with patch("brother.Brother.initialize"), patch(
"brother.datetime", utcnow=Mock(return_value=test_time)
"brother.datetime", now=Mock(return_value=test_time)
), patch(
"brother.Brother._get_data",
return_value=json.loads(load_fixture("printer_data.json", "brother")),

View File

@ -48,7 +48,7 @@ async def test_sensors(hass: HomeAssistant) -> None:
)
test_time = datetime(2019, 11, 11, 9, 10, 32, tzinfo=UTC)
with patch("brother.Brother.initialize"), patch(
"brother.datetime", utcnow=Mock(return_value=test_time)
"brother.datetime", now=Mock(return_value=test_time)
), patch(
"brother.Brother._get_data",
return_value=json.loads(load_fixture("printer_data.json", "brother")),