From 690f1c07a7204e5ae1e781287e6c24fb55ac0693 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 24 Jan 2025 09:59:50 +0100 Subject: [PATCH] Use version which is treated CalVer by AwesomeVersion (#5572) * Use version which is treated CalVer by AwesomeVersion The current dev version `99.9.9dev` is treated as unkown version type by AwesomeVersion. This prevents the version from comparing with actual Supervisor versions, e.g. from an exsiting backup file. Make the development version a valid CalVer version so development versions can handle non-development backups. * Bump to year 9999 --- setup.py | 2 +- supervisor/const.py | 2 +- tests/api/test_root.py | 2 +- tests/backups/conftest.py | 4 ++-- tests/test_coresys.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index cc2dc8f8e..8e09ae7a5 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ def _get_supervisor_version(): for line in CONSTANTS.split("/n"): if match := RE_SUPERVISOR_VERSION.match(line): return match.group(1) - return "99.9.9dev" + return "9999.09.9.dev9999" setup( diff --git a/supervisor/const.py b/supervisor/const.py index 1f1fec244..7d1c829e1 100644 --- a/supervisor/const.py +++ b/supervisor/const.py @@ -9,7 +9,7 @@ from typing import Self from aiohttp import __version__ as aiohttpversion -SUPERVISOR_VERSION = "99.9.9dev" +SUPERVISOR_VERSION = "9999.09.9.dev9999" SERVER_SOFTWARE = f"HomeAssistantSupervisor/{SUPERVISOR_VERSION} aiohttp/{aiohttpversion} Python/{systemversion[0]}.{systemversion[1]}" URL_HASSIO_ADDONS = "https://github.com/home-assistant/addons" diff --git a/tests/api/test_root.py b/tests/api/test_root.py index 88b2c3754..a497f97c5 100644 --- a/tests/api/test_root.py +++ b/tests/api/test_root.py @@ -14,7 +14,7 @@ async def test_api_info(api_client): resp = await api_client.get("/info") result = await resp.json() - assert result["data"]["supervisor"] == "99.9.9dev" + assert result["data"]["supervisor"] == "9999.09.9.dev9999" assert result["data"]["docker"] == "1.0.0" assert result["data"]["supported"] is True assert result["data"]["channel"] == "stable" diff --git a/tests/backups/conftest.py b/tests/backups/conftest.py index 4d8bfd6d4..8aec498fd 100644 --- a/tests/backups/conftest.py +++ b/tests/backups/conftest.py @@ -39,7 +39,7 @@ def partial_backup_mock(backup_mock): backup_instance.sys_type = BackupType.PARTIAL backup_instance.folders = [] backup_instance.addon_list = [TEST_ADDON_SLUG] - backup_instance.supervisor_version = "99.9.9dev" + backup_instance.supervisor_version = "9999.09.9.dev9999" yield backup_mock @@ -50,7 +50,7 @@ def full_backup_mock(backup_mock): backup_instance.sys_type = BackupType.FULL backup_instance.folders = ALL_FOLDERS backup_instance.addon_list = [TEST_ADDON_SLUG] - backup_instance.supervisor_version = "99.9.9dev" + backup_instance.supervisor_version = "9999.09.9.dev9999" yield backup_mock diff --git a/tests/test_coresys.py b/tests/test_coresys.py index 560b70bd0..47d843f5d 100644 --- a/tests/test_coresys.py +++ b/tests/test_coresys.py @@ -39,6 +39,6 @@ def test_now(coresys: CoreSys): def test_custom_user_agent(coresys: CoreSys): """Test custom useragent.""" assert ( - "HomeAssistantSupervisor/99.9.9dev" + "HomeAssistantSupervisor/9999.09.9.dev9999" in coresys.websession._default_headers[USER_AGENT] # pylint: disable=protected-access )