1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 20:35:55 +00:00

Bump pre-commit ruff to 0.5.7 and reformat (#5242)

It seems that the codebase is not formatted with the latest ruff
version. This PR reformats the codebase with ruff 0.5.7.
This commit is contained in:
Stefan Agner
2024-08-13 20:53:56 +02:00
committed by GitHub
parent 21ae2c2e54
commit f6faa18409
304 changed files with 1173 additions and 617 deletions

View File

@@ -1,4 +1,5 @@
"""Test addon build."""
from unittest.mock import PropertyMock, patch
from awesomeversion import AwesomeVersion
@@ -11,10 +12,13 @@ from supervisor.coresys import CoreSys
async def test_platform_set(coresys: CoreSys, install_addon_ssh: Addon):
"""Test platform set in docker args."""
build = AddonBuild(coresys, install_addon_ssh)
with patch.object(
type(coresys.arch), "supported", new=PropertyMock(return_value=["amd64"])
), patch.object(
type(coresys.arch), "default", new=PropertyMock(return_value="amd64")
with (
patch.object(
type(coresys.arch), "supported", new=PropertyMock(return_value=["amd64"])
),
patch.object(
type(coresys.arch), "default", new=PropertyMock(return_value="amd64")
),
):
args = build.get_docker_args(AwesomeVersion("latest"))
@@ -24,10 +28,13 @@ async def test_platform_set(coresys: CoreSys, install_addon_ssh: Addon):
async def test_dockerfile_evaluation(coresys: CoreSys, install_addon_ssh: Addon):
"""Test platform set in docker args."""
build = AddonBuild(coresys, install_addon_ssh)
with patch.object(
type(coresys.arch), "supported", new=PropertyMock(return_value=["amd64"])
), patch.object(
type(coresys.arch), "default", new=PropertyMock(return_value="amd64")
with (
patch.object(
type(coresys.arch), "supported", new=PropertyMock(return_value=["amd64"])
),
patch.object(
type(coresys.arch), "default", new=PropertyMock(return_value="amd64")
),
):
args = build.get_docker_args(AwesomeVersion("latest"))
@@ -39,10 +46,13 @@ async def test_dockerfile_evaluation(coresys: CoreSys, install_addon_ssh: Addon)
async def test_dockerfile_evaluation_arch(coresys: CoreSys, install_addon_ssh: Addon):
"""Test platform set in docker args."""
build = AddonBuild(coresys, install_addon_ssh)
with patch.object(
type(coresys.arch), "supported", new=PropertyMock(return_value=["aarch64"])
), patch.object(
type(coresys.arch), "default", new=PropertyMock(return_value="aarch64")
with (
patch.object(
type(coresys.arch), "supported", new=PropertyMock(return_value=["aarch64"])
),
patch.object(
type(coresys.arch), "default", new=PropertyMock(return_value="aarch64")
),
):
args = build.get_docker_args(AwesomeVersion("latest"))
@@ -56,10 +66,13 @@ async def test_dockerfile_evaluation_arch(coresys: CoreSys, install_addon_ssh: A
async def test_build_valid(coresys: CoreSys, install_addon_ssh: Addon):
"""Test platform set in docker args."""
build = AddonBuild(coresys, install_addon_ssh)
with patch.object(
type(coresys.arch), "supported", new=PropertyMock(return_value=["aarch64"])
), patch.object(
type(coresys.arch), "default", new=PropertyMock(return_value="aarch64")
with (
patch.object(
type(coresys.arch), "supported", new=PropertyMock(return_value=["aarch64"])
),
patch.object(
type(coresys.arch), "default", new=PropertyMock(return_value="aarch64")
),
):
assert build.is_valid
@@ -67,9 +80,12 @@ async def test_build_valid(coresys: CoreSys, install_addon_ssh: Addon):
async def test_build_invalid(coresys: CoreSys, install_addon_ssh: Addon):
"""Test platform set in docker args."""
build = AddonBuild(coresys, install_addon_ssh)
with patch.object(
type(coresys.arch), "supported", new=PropertyMock(return_value=["amd64"])
), patch.object(
type(coresys.arch), "default", new=PropertyMock(return_value="amd64")
with (
patch.object(
type(coresys.arch), "supported", new=PropertyMock(return_value=["amd64"])
),
patch.object(
type(coresys.arch), "default", new=PropertyMock(return_value="amd64")
),
):
assert not build.is_valid