Fix asyncio.wait in supervisor.reload (#4333)

* Fix asyncio.wait in supervisor.reload

* Unwrap to prevent throttling across tests
This commit is contained in:
Mike Degatano
2023-06-01 18:38:42 -04:00
committed by GitHub
parent 0200c72db1
commit c896b60410
3 changed files with 19 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ from unittest.mock import patch
from supervisor.coresys import CoreSys
from supervisor.docker.interface import DockerInterface
from supervisor.homeassistant.secrets import HomeAssistantSecrets
async def test_load(coresys: CoreSys, tmp_supervisor_data: Path):
@@ -12,7 +13,12 @@ async def test_load(coresys: CoreSys, tmp_supervisor_data: Path):
with open(tmp_supervisor_data / "homeassistant" / "secrets.yaml", "w") as secrets:
secrets.write("hello: world\n")
with patch.object(DockerInterface, "attach") as attach:
# Unwrap read_secrets to prevent throttling between tests
with patch.object(DockerInterface, "attach") as attach, patch.object(
HomeAssistantSecrets,
"_read_secrets",
new=HomeAssistantSecrets._read_secrets.__wrapped__,
):
await coresys.homeassistant.load()
attach.assert_called_once()