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

Migrate to Ruff for lint and format (#4852)

* Migrate to Ruff for lint and format

* Fix pylint issues

* DBus property sets into normal awaitable methods

* Fix tests relying on separate tasks in connect

* Fixes from feedback
This commit is contained in:
Mike Degatano
2024-02-05 11:37:39 -05:00
committed by GitHub
parent 1861d756e9
commit 7fd6dce55f
122 changed files with 694 additions and 668 deletions

View File

@@ -45,10 +45,8 @@ async def test_api_store(
@pytest.mark.asyncio
async def test_api_store_addons(api_client: TestClient, store_addon: AddonStore):
"""Test /store/addons REST API."""
print("test")
resp = await api_client.get("/store/addons")
result = await resp.json()
print(result)
assert result["data"]["addons"][-1]["slug"] == store_addon.slug
@@ -139,6 +137,7 @@ async def test_api_store_update_healthcheck(
assert install_addon_ssh.need_update is True
state_changes: list[AddonState] = []
_container_events_task: asyncio.Task | None = None
async def container_events():
nonlocal state_changes
@@ -174,7 +173,8 @@ async def test_api_store_update_healthcheck(
)
async def container_events_task(*args, **kwargs):
asyncio.create_task(container_events())
nonlocal _container_events_task
_container_events_task = asyncio.create_task(container_events())
with patch.object(DockerAddon, "run", new=container_events_task), patch.object(
DockerInterface, "install"
@@ -186,3 +186,5 @@ async def test_api_store_update_healthcheck(
assert state_changes == [AddonState.STOPPED, AddonState.STARTUP]
assert install_addon_ssh.state == AddonState.STARTED
assert resp.status == 200
await _container_events_task