From 64e39c9c81eab4414a55c2b12c4b8a752dbf898c Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Wed, 22 Feb 2023 20:28:58 +0100 Subject: [PATCH] Bump brother to 2.2.0 (#88618) --- homeassistant/components/brother/__init__.py | 4 ++-- homeassistant/components/brother/config_flow.py | 6 +++--- homeassistant/components/brother/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/brother/test_config_flow.py | 4 ++-- tests/components/brother/test_diagnostics.py | 2 +- tests/components/brother/test_sensor.py | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/brother/__init__.py b/homeassistant/components/brother/__init__.py index e0d0a0ca44c..5f05caf0fc1 100644 --- a/homeassistant/components/brother/__init__.py +++ b/homeassistant/components/brother/__init__.py @@ -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 diff --git a/homeassistant/components/brother/config_flow.py b/homeassistant/components/brother/config_flow.py index 48c73d0c4d1..55d47bb0c2c 100644 --- a/homeassistant/components/brother/config_flow.py +++ b/homeassistant/components/brother/config_flow.py @@ -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") diff --git a/homeassistant/components/brother/manifest.json b/homeassistant/components/brother/manifest.json index db8a432e1fd..bd5d877b4f3 100644 --- a/homeassistant/components/brother/manifest.json +++ b/homeassistant/components/brother/manifest.json @@ -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.", diff --git a/requirements_all.txt b/requirements_all.txt index cad22977a98..7d0e175bde3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 29efeeffd6e..425c87c7a85 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -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 diff --git a/tests/components/brother/test_config_flow.py b/tests/components/brother/test_config_flow.py index 832e874a466..9dc871bb4ca 100644 --- a/tests/components/brother/test_config_flow.py +++ b/tests/components/brother/test_config_flow.py @@ -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 diff --git a/tests/components/brother/test_diagnostics.py b/tests/components/brother/test_diagnostics.py index 2a5fa936178..ce09fe13d1a 100644 --- a/tests/components/brother/test_diagnostics.py +++ b/tests/components/brother/test_diagnostics.py @@ -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")), diff --git a/tests/components/brother/test_sensor.py b/tests/components/brother/test_sensor.py index f95322b01a7..6769d219403 100644 --- a/tests/components/brother/test_sensor.py +++ b/tests/components/brother/test_sensor.py @@ -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")),