1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

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
1044 changed files with 24245 additions and 16750 deletions

View File

@@ -36,13 +36,14 @@ async def test_get_system_info_supervisor_not_available(
) -> None:
"""Test the get system info when supervisor is not available."""
hass.config.components.add("hassio")
with patch("platform.system", return_value="Linux"), patch(
"homeassistant.helpers.system_info.is_docker_env", return_value=True
), patch(
"homeassistant.helpers.system_info.is_official_image", return_value=True
), patch.object(hassio, "is_hassio", return_value=True), patch.object(
hassio, "get_info", return_value=None
), patch("homeassistant.helpers.system_info.cached_get_user", return_value="root"):
with (
patch("platform.system", return_value="Linux"),
patch("homeassistant.helpers.system_info.is_docker_env", return_value=True),
patch("homeassistant.helpers.system_info.is_official_image", return_value=True),
patch.object(hassio, "is_hassio", return_value=True),
patch.object(hassio, "get_info", return_value=None),
patch("homeassistant.helpers.system_info.cached_get_user", return_value="root"),
):
info = await async_get_system_info(hass)
assert isinstance(info, dict)
assert info["version"] == current_version
@@ -54,12 +55,12 @@ async def test_get_system_info_supervisor_not_available(
async def test_get_system_info_supervisor_not_loaded(hass: HomeAssistant) -> None:
"""Test the get system info when supervisor is not loaded."""
with patch("platform.system", return_value="Linux"), patch(
"homeassistant.helpers.system_info.is_docker_env", return_value=True
), patch(
"homeassistant.helpers.system_info.is_official_image", return_value=True
), patch.object(hassio, "get_info", return_value=None), patch.dict(
os.environ, {"SUPERVISOR": "127.0.0.1"}
with (
patch("platform.system", return_value="Linux"),
patch("homeassistant.helpers.system_info.is_docker_env", return_value=True),
patch("homeassistant.helpers.system_info.is_official_image", return_value=True),
patch.object(hassio, "get_info", return_value=None),
patch.dict(os.environ, {"SUPERVISOR": "127.0.0.1"}),
):
info = await async_get_system_info(hass)
assert isinstance(info, dict)
@@ -71,19 +72,23 @@ async def test_get_system_info_supervisor_not_loaded(hass: HomeAssistant) -> Non
async def test_container_installationtype(hass: HomeAssistant) -> None:
"""Test container installation type."""
with patch("platform.system", return_value="Linux"), patch(
"homeassistant.helpers.system_info.is_docker_env", return_value=True
), patch(
"homeassistant.helpers.system_info.is_official_image", return_value=True
), patch("homeassistant.helpers.system_info.cached_get_user", return_value="root"):
with (
patch("platform.system", return_value="Linux"),
patch("homeassistant.helpers.system_info.is_docker_env", return_value=True),
patch("homeassistant.helpers.system_info.is_official_image", return_value=True),
patch("homeassistant.helpers.system_info.cached_get_user", return_value="root"),
):
info = await async_get_system_info(hass)
assert info["installation_type"] == "Home Assistant Container"
with patch("platform.system", return_value="Linux"), patch(
"homeassistant.helpers.system_info.is_docker_env", return_value=True
), patch(
"homeassistant.helpers.system_info.is_official_image", return_value=False
), patch("homeassistant.helpers.system_info.cached_get_user", return_value="user"):
with (
patch("platform.system", return_value="Linux"),
patch("homeassistant.helpers.system_info.is_docker_env", return_value=True),
patch(
"homeassistant.helpers.system_info.is_official_image", return_value=False
),
patch("homeassistant.helpers.system_info.cached_get_user", return_value="user"),
):
info = await async_get_system_info(hass)
assert info["installation_type"] == "Unsupported Third Party Container"