1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2026-04-20 00:18:09 +01:00

Respect auto-update setting for plug-in auto-updates (#6606)

* Respect auto-update setting for plug-in auto-updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Also skip auto-updating plug-ins in decorator

* Raise if auto-update flag is not set and plug-in is not up to date

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Stefan Agner
2026-03-05 09:04:33 +01:00
committed by GitHub
parent 9e0d3fe461
commit 5e1eaa9dfe
6 changed files with 88 additions and 1 deletions

View File

@@ -69,3 +69,31 @@ async def test_load(
assert attach.call_count == 10
assert update.call_count == 5
@pytest.mark.usefixtures("no_job_throttle")
async def test_load_skip_update_auto_update_disabled(
coresys: CoreSys, mock_update_data: MockResponse, supervisor_internet: AsyncMock
):
"""Test plugin manager load skips updates when auto update is disabled."""
coresys.hardware.disk.get_disk_free_space = lambda x: 5000
await coresys.updater.load()
await coresys.updater.reload()
coresys.updater.auto_update = False
with (
patch.object(DockerInterface, "attach") as attach,
patch.object(DockerInterface, "update") as update,
patch.object(Supervisor, "need_update", new=PropertyMock(return_value=False)),
patch.object(PluginBase, "need_update", new=PropertyMock(return_value=True)),
patch.object(
PluginBase,
"version",
new=PropertyMock(return_value=AwesomeVersion("1970-01-01")),
),
):
await coresys.plugins.load()
assert attach.call_count == 5
update.assert_not_called()