From 3e01e393a88f36511c95c32d59677a08ece416db Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 20 Nov 2024 14:08:07 +0100 Subject: [PATCH 1/3] Report backup size in bytes instead of MB (#131028) Co-authored-by: Robert Resch --- homeassistant/components/backup/backup.py | 2 +- homeassistant/components/backup/manager.py | 2 +- homeassistant/components/backup/models.py | 2 +- homeassistant/components/backup/util.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/backup/backup.py b/homeassistant/components/backup/backup.py index 7dad124c2f6..4dc12cee23b 100644 --- a/homeassistant/components/backup/backup.py +++ b/homeassistant/components/backup/backup.py @@ -56,7 +56,7 @@ class CoreLocalBackupAgent(LocalBackupAgent): backup_id=base_backup.backup_id, name=base_backup.name, date=base_backup.date, - size=round(backup_path.stat().st_size / 1_048_576, 2), + size=backup_path.stat().st_size, protected=base_backup.protected, ) backups[backup.backup_id] = backup diff --git a/homeassistant/components/backup/manager.py b/homeassistant/components/backup/manager.py index b1ea9cd1093..672c2ed3f1f 100644 --- a/homeassistant/components/backup/manager.py +++ b/homeassistant/components/backup/manager.py @@ -613,7 +613,7 @@ class CoreBackupReaderWriter(BackupReaderWriter): date=date_str, name=backup_name, protected=password is not None, - size=round(size_in_bytes / 1_048_576, 2), + size=size_in_bytes, ) success = True return (backup, tar_file_path) diff --git a/homeassistant/components/backup/models.py b/homeassistant/components/backup/models.py index 0ac2727983f..d0b7c71bbce 100644 --- a/homeassistant/components/backup/models.py +++ b/homeassistant/components/backup/models.py @@ -11,7 +11,7 @@ class BaseBackup: date: str name: str protected: bool - size: float + size: int def as_dict(self) -> dict: """Return a dict representation of this backup.""" diff --git a/homeassistant/components/backup/util.py b/homeassistant/components/backup/util.py index c507f69ec6e..d602f29af32 100644 --- a/homeassistant/components/backup/util.py +++ b/homeassistant/components/backup/util.py @@ -24,5 +24,5 @@ def read_backup(backup_path: Path) -> BaseBackup: date=cast(str, data["date"]), name=cast(str, data["name"]), protected=cast(bool, data.get("protected", False)), - size=round(backup_path.stat().st_size / 1_048_576, 2), + size=backup_path.stat().st_size, ) From 791280506d1859b1a722f5064d75bcbe48acc1c3 Mon Sep 17 00:00:00 2001 From: Robert Resch Date: Wed, 20 Nov 2024 14:08:21 +0100 Subject: [PATCH 2/3] Speed up CI for feature branch (#131030) * Speed up CI for feature branch * adjust * fix * fix * fix * fix --- .github/workflows/ci.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fa05f6082a2..04130923021 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,7 @@ env: MYPY_CACHE_VERSION: 9 HA_SHORT_VERSION: "2024.12" DEFAULT_PYTHON: "3.12" - ALL_PYTHON_VERSIONS: "['3.12', '3.13']" + ALL_PYTHON_VERSIONS: "['3.13']" # 10.3 is the oldest supported version # - 10.3.32 is the version currently shipped with Synology (as of 17 Feb 2022) # 10.6 is the current long-term-support @@ -76,20 +76,21 @@ jobs: # In case of issues with the partial run, use the following line instead: # test_full_suite: 'true' core: ${{ steps.core.outputs.changes }} - integrations_glob: ${{ steps.info.outputs.integrations_glob }} integrations: ${{ steps.integrations.outputs.changes }} pre-commit_cache_key: ${{ steps.generate_pre-commit_cache_key.outputs.key }} python_cache_key: ${{ steps.generate_python_cache_key.outputs.key }} requirements: ${{ steps.core.outputs.requirements }} - mariadb_groups: ${{ steps.info.outputs.mariadb_groups }} - postgresql_groups: ${{ steps.info.outputs.postgresql_groups }} python_versions: ${{ steps.info.outputs.python_versions }} - test_full_suite: ${{ steps.info.outputs.test_full_suite }} test_group_count: ${{ steps.info.outputs.test_group_count }} - test_groups: ${{ steps.info.outputs.test_groups }} - tests_glob: ${{ steps.info.outputs.tests_glob }} - tests: ${{ steps.info.outputs.tests }} skip_coverage: ${{ steps.info.outputs.skip_coverage }} + + mariadb_groups: "[]" + postgresql_groups: "[]" + test_full_suite: "false" + integrations_glob: "{backup,cloud,hassio,kitchen_sink,demo}" + test_groups: '["backup", "cloud", "hassio", "kitchen_sink", "demo"]' + tests: '["backup", "cloud", "hassio", "kitchen_sink", "demo"]' + tests_glob: "{backup,cloud,hassio,kitchen_sink,demo}" runs-on: ubuntu-24.04 steps: - name: Check out code from GitHub From 30c8ff775a69084878a994852253e5fb4d242b56 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 20 Nov 2024 15:21:31 +0100 Subject: [PATCH 3/3] Rename remove to delete in backup websocket type (#131023) --- homeassistant/components/backup/websocket.py | 2 +- tests/components/backup/test_websocket.py | 4 ++-- tests/components/kitchen_sink/test_backup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/backup/websocket.py b/homeassistant/components/backup/websocket.py index d4ca8e1e377..a608a2a03c0 100644 --- a/homeassistant/components/backup/websocket.py +++ b/homeassistant/components/backup/websocket.py @@ -87,7 +87,7 @@ async def handle_details( @websocket_api.require_admin @websocket_api.websocket_command( { - vol.Required("type"): "backup/remove", + vol.Required("type"): "backup/delete", vol.Required("backup_id"): str, } ) diff --git a/tests/components/backup/test_websocket.py b/tests/components/backup/test_websocket.py index 2cc028da78b..8c97e18f87c 100644 --- a/tests/components/backup/test_websocket.py +++ b/tests/components/backup/test_websocket.py @@ -217,7 +217,7 @@ async def test_delete( await client.send_json_auto_id({"type": "backup/info"}) assert await client.receive_json() == snapshot - await client.send_json_auto_id({"type": "backup/remove", "backup_id": "abc123"}) + await client.send_json_auto_id({"type": "backup/delete", "backup_id": "abc123"}) assert await client.receive_json() == snapshot await client.send_json_auto_id({"type": "backup/info"}) @@ -239,7 +239,7 @@ async def test_agent_delete_backup( with patch.object(BackupAgentTest, "async_delete_backup") as delete_mock: await client.send_json_auto_id( { - "type": "backup/remove", + "type": "backup/delete", "backup_id": "abc123", } ) diff --git a/tests/components/kitchen_sink/test_backup.py b/tests/components/kitchen_sink/test_backup.py index 551f8c5ac3e..4719968a40e 100644 --- a/tests/components/kitchen_sink/test_backup.py +++ b/tests/components/kitchen_sink/test_backup.py @@ -165,7 +165,7 @@ async def test_agent_delete_backup( await client.send_json_auto_id( { - "type": "backup/remove", + "type": "backup/delete", "backup_id": backup_id, } )