Bump ruff to 0.3.4 (#112690)

Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Joost Lekkerkerker 2024-03-26 00:02:16 +01:00 committed by GitHub
parent 27219b6962
commit 6bb4e7d62c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1044 changed files with 24245 additions and 16750 deletions

View file

@ -38,14 +38,19 @@ async def patch_async_query_unauthorized(self, *args):
async def test_user_form(hass: HomeAssistant) -> None:
"""Test user-initiated flow, including discovery and the edit step."""
with patch(
"pysqueezebox.Server.async_query",
return_value={"uuid": UUID},
), patch(
"homeassistant.components.squeezebox.async_setup_entry",
return_value=True,
) as mock_setup_entry, patch(
"homeassistant.components.squeezebox.config_flow.async_discover", mock_discover
with (
patch(
"pysqueezebox.Server.async_query",
return_value={"uuid": UUID},
),
patch(
"homeassistant.components.squeezebox.async_setup_entry",
return_value=True,
) as mock_setup_entry,
patch(
"homeassistant.components.squeezebox.config_flow.async_discover",
mock_discover,
),
):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -84,10 +89,13 @@ async def test_user_form(hass: HomeAssistant) -> None:
async def test_user_form_timeout(hass: HomeAssistant) -> None:
"""Test we handle server search timeout."""
with patch(
"homeassistant.components.squeezebox.config_flow.async_discover",
mock_failed_discover,
), patch("homeassistant.components.squeezebox.config_flow.TIMEOUT", 0.1):
with (
patch(
"homeassistant.components.squeezebox.config_flow.async_discover",
mock_failed_discover,
),
patch("homeassistant.components.squeezebox.config_flow.TIMEOUT", 0.1),
):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
@ -108,12 +116,16 @@ async def test_user_form_timeout(hass: HomeAssistant) -> None:
async def test_user_form_duplicate(hass: HomeAssistant) -> None:
"""Test duplicate discovered servers are skipped."""
with patch(
"homeassistant.components.squeezebox.config_flow.async_discover",
mock_discover,
), patch("homeassistant.components.squeezebox.config_flow.TIMEOUT", 0.1), patch(
"homeassistant.components.squeezebox.async_setup_entry",
return_value=True,
with (
patch(
"homeassistant.components.squeezebox.config_flow.async_discover",
mock_discover,
),
patch("homeassistant.components.squeezebox.config_flow.TIMEOUT", 0.1),
patch(
"homeassistant.components.squeezebox.async_setup_entry",
return_value=True,
),
):
entry = MockConfigEntry(
domain=DOMAIN,
@ -207,11 +219,15 @@ async def test_discovery_no_uuid(hass: HomeAssistant) -> None:
async def test_dhcp_discovery(hass: HomeAssistant) -> None:
"""Test we can process discovery from dhcp."""
with patch(
"pysqueezebox.Server.async_query",
return_value={"uuid": UUID},
), patch(
"homeassistant.components.squeezebox.config_flow.async_discover", mock_discover
with (
patch(
"pysqueezebox.Server.async_query",
return_value={"uuid": UUID},
),
patch(
"homeassistant.components.squeezebox.config_flow.async_discover",
mock_discover,
),
):
result = await hass.config_entries.flow.async_init(
DOMAIN,
@ -228,10 +244,13 @@ async def test_dhcp_discovery(hass: HomeAssistant) -> None:
async def test_dhcp_discovery_no_server_found(hass: HomeAssistant) -> None:
"""Test we can handle dhcp discovery when no server is found."""
with patch(
"homeassistant.components.squeezebox.config_flow.async_discover",
mock_failed_discover,
), patch("homeassistant.components.squeezebox.config_flow.TIMEOUT", 0.1):
with (
patch(
"homeassistant.components.squeezebox.config_flow.async_discover",
mock_failed_discover,
),
patch("homeassistant.components.squeezebox.config_flow.TIMEOUT", 0.1),
):
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_DHCP},