diff --git a/requirements.txt b/requirements.txt index c354e620c..2451c6af2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,5 +28,5 @@ securetar==2025.2.1 sentry-sdk==2.46.0 setuptools==80.9.0 voluptuous==0.15.2 -dbus-fast==2.45.1 +dbus-fast==3.1.2 zlib-fast==0.2.1 diff --git a/supervisor/dbus/resolved.py b/supervisor/dbus/resolved.py index 4ac66a3b3..9bf53e95d 100644 --- a/supervisor/dbus/resolved.py +++ b/supervisor/dbus/resolved.py @@ -75,7 +75,7 @@ class Resolved(DBusInterfaceProxy): @dbus_property def current_dns_server( self, - ) -> list[tuple[int, DNSAddressFamily, bytes]] | None: + ) -> tuple[int, DNSAddressFamily, bytes] | None: """Return current DNS server.""" return self.properties[DBUS_ATTR_CURRENT_DNS_SERVER] @@ -83,7 +83,7 @@ class Resolved(DBusInterfaceProxy): @dbus_property def current_dns_server_ex( self, - ) -> list[tuple[int, DNSAddressFamily, bytes, int, str]] | None: + ) -> tuple[int, DNSAddressFamily, bytes, int, str] | None: """Return current DNS server including port and server name.""" return self.properties[DBUS_ATTR_CURRENT_DNS_SERVER_EX] diff --git a/tests/dbus/test_resolved.py b/tests/dbus/test_resolved.py index 93681025f..c0635cf1c 100644 --- a/tests/dbus/test_resolved.py +++ b/tests/dbus/test_resolved.py @@ -41,51 +41,51 @@ async def test_dbus_resolved_info( assert resolved.dns_over_tls == DNSOverTLSEnabled.NO assert len(resolved.dns) == 2 - assert resolved.dns[0] == [0, 2, inet_aton("127.0.0.1")] - assert resolved.dns[1] == [0, 10, inet_pton(AF_INET6, "::1")] + assert resolved.dns[0] == (0, 2, inet_aton("127.0.0.1")) + assert resolved.dns[1] == (0, 10, inet_pton(AF_INET6, "::1")) assert len(resolved.dns_ex) == 2 - assert resolved.dns_ex[0] == [0, 2, inet_aton("127.0.0.1"), 0, ""] - assert resolved.dns_ex[1] == [0, 10, inet_pton(AF_INET6, "::1"), 0, ""] + assert resolved.dns_ex[0] == (0, 2, inet_aton("127.0.0.1"), 0, "") + assert resolved.dns_ex[1] == (0, 10, inet_pton(AF_INET6, "::1"), 0, "") assert len(resolved.fallback_dns) == 2 - assert resolved.fallback_dns[0] == [0, 2, inet_aton("1.1.1.1")] - assert resolved.fallback_dns[1] == [ + assert resolved.fallback_dns[0] == (0, 2, inet_aton("1.1.1.1")) + assert resolved.fallback_dns[1] == ( 0, 10, inet_pton(AF_INET6, "2606:4700:4700::1111"), - ] + ) assert len(resolved.fallback_dns_ex) == 2 - assert resolved.fallback_dns_ex[0] == [ + assert resolved.fallback_dns_ex[0] == ( 0, 2, inet_aton("1.1.1.1"), 0, "cloudflare-dns.com", - ] - assert resolved.fallback_dns_ex[1] == [ + ) + assert resolved.fallback_dns_ex[1] == ( 0, 10, inet_pton(AF_INET6, "2606:4700:4700::1111"), 0, "cloudflare-dns.com", - ] + ) - assert resolved.current_dns_server == [0, 2, inet_aton("127.0.0.1")] - assert resolved.current_dns_server_ex == [ + assert resolved.current_dns_server == (0, 2, inet_aton("127.0.0.1")) + assert resolved.current_dns_server_ex == ( 0, 2, inet_aton("127.0.0.1"), 0, "", - ] + ) assert len(resolved.domains) == 1 - assert resolved.domains[0] == [0, "local.hass.io", False] + assert resolved.domains[0] == (0, "local.hass.io", False) - assert resolved.transaction_statistics == [0, 100000] - assert resolved.cache_statistics == [10, 50000, 10000] + assert resolved.transaction_statistics == (0, 100000) + assert resolved.cache_statistics == (10, 50000, 10000) assert resolved.dnssec == DNSSECValidation.NO - assert resolved.dnssec_statistics == [0, 0, 0, 0] + assert resolved.dnssec_statistics == (0, 0, 0, 0) assert resolved.dnssec_supported is False assert resolved.dnssec_negative_trust_anchors == [ "168.192.in-addr.arpa", diff --git a/tests/dbus/test_systemd.py b/tests/dbus/test_systemd.py index fb0c54da2..09fb22574 100644 --- a/tests/dbus/test_systemd.py +++ b/tests/dbus/test_systemd.py @@ -185,10 +185,10 @@ async def test_start_transient_unit( "tmp-test.mount", "fail", [ - ["Description", Variant("s", "Test")], - ["What", Variant("s", "//homeassistant/config")], - ["Type", Variant("s", "cifs")], - ["Options", Variant("s", "username=homeassistant,password=password")], + ("Description", Variant("s", "Test")), + ("What", Variant("s", "//homeassistant/config")), + ("Type", Variant("s", "cifs")), + ("Options", Variant("s", "username=homeassistant,password=password")), ], [], ) diff --git a/tests/dbus_service_mocks/resolved.py b/tests/dbus_service_mocks/resolved.py index e4267c4ed..010fda80f 100644 --- a/tests/dbus_service_mocks/resolved.py +++ b/tests/dbus_service_mocks/resolved.py @@ -45,8 +45,8 @@ class Resolved(DBusServiceMock): def DNS(self) -> "a(iiay)": """Get DNS.""" return [ - [0, 2, bytes([127, 0, 0, 1])], - [ + (0, 2, bytes([127, 0, 0, 1])), + ( 0, 10, bytes( @@ -69,15 +69,15 @@ class Resolved(DBusServiceMock): 0x1, ] ), - ], + ), ] @dbus_property(access=PropertyAccess.READ) def DNSEx(self) -> "a(iiayqs)": """Get DNSEx.""" return [ - [0, 2, bytes([127, 0, 0, 1]), 0, ""], - [ + (0, 2, bytes([127, 0, 0, 1]), 0, ""), + ( 0, 10, bytes( @@ -102,15 +102,15 @@ class Resolved(DBusServiceMock): ), 0, "", - ], + ), ] @dbus_property(access=PropertyAccess.READ) def FallbackDNS(self) -> "a(iiay)": """Get FallbackDNS.""" return [ - [0, 2, bytes([1, 1, 1, 1])], - [ + (0, 2, bytes([1, 1, 1, 1])), + ( 0, 10, bytes( @@ -133,15 +133,15 @@ class Resolved(DBusServiceMock): 0x11, ] ), - ], + ), ] @dbus_property(access=PropertyAccess.READ) def FallbackDNSEx(self) -> "a(iiayqs)": """Get FallbackDNSEx.""" return [ - [0, 2, bytes([1, 1, 1, 1]), 0, "cloudflare-dns.com"], - [ + (0, 2, bytes([1, 1, 1, 1]), 0, "cloudflare-dns.com"), + ( 0, 10, bytes( @@ -166,33 +166,33 @@ class Resolved(DBusServiceMock): ), 0, "cloudflare-dns.com", - ], + ), ] @dbus_property(access=PropertyAccess.READ) def CurrentDNSServer(self) -> "(iiay)": """Get CurrentDNSServer.""" - return [0, 2, bytes([127, 0, 0, 1])] + return (0, 2, bytes([127, 0, 0, 1])) @dbus_property(access=PropertyAccess.READ) def CurrentDNSServerEx(self) -> "(iiayqs)": """Get CurrentDNSServerEx.""" - return [0, 2, bytes([127, 0, 0, 1]), 0, ""] + return (0, 2, bytes([127, 0, 0, 1]), 0, "") @dbus_property(access=PropertyAccess.READ) def Domains(self) -> "a(isb)": """Get Domains.""" - return [[0, "local.hass.io", False]] + return [(0, "local.hass.io", False)] @dbus_property(access=PropertyAccess.READ) def TransactionStatistics(self) -> "(tt)": """Get TransactionStatistics.""" - return [0, 100000] + return (0, 100000) @dbus_property(access=PropertyAccess.READ) def CacheStatistics(self) -> "(ttt)": """Get CacheStatistics.""" - return [10, 50000, 10000] + return (10, 50000, 10000) @dbus_property(access=PropertyAccess.READ) def DNSSEC(self) -> "s": @@ -202,7 +202,7 @@ class Resolved(DBusServiceMock): @dbus_property(access=PropertyAccess.READ) def DNSSECStatistics(self) -> "(tttt)": """Get DNSSECStatistics.""" - return [0, 0, 0, 0] + return (0, 0, 0, 0) @dbus_property(access=PropertyAccess.READ) def DNSSECSupported(self) -> "b": diff --git a/tests/mounts/test_manager.py b/tests/mounts/test_manager.py index 6fae3d597..b9f350a95 100644 --- a/tests/mounts/test_manager.py +++ b/tests/mounts/test_manager.py @@ -119,10 +119,10 @@ async def test_load( "mnt-data-supervisor-mounts-backup_test.mount", "fail", [ - ["Options", Variant("s", "noserverino,guest")], - ["Type", Variant("s", "cifs")], - ["Description", Variant("s", "Supervisor cifs mount: backup_test")], - ["What", Variant("s", "//backup.local/backups")], + ("Options", Variant("s", "noserverino,guest")), + ("Type", Variant("s", "cifs")), + ("Description", Variant("s", "Supervisor cifs mount: backup_test")), + ("What", Variant("s", "//backup.local/backups")), ], [], ), @@ -130,10 +130,10 @@ async def test_load( "mnt-data-supervisor-mounts-media_test.mount", "fail", [ - ["Options", Variant("s", "soft,timeo=200")], - ["Type", Variant("s", "nfs")], - ["Description", Variant("s", "Supervisor nfs mount: media_test")], - ["What", Variant("s", "media.local:/media")], + ("Options", Variant("s", "soft,timeo=200")), + ("Type", Variant("s", "nfs")), + ("Description", Variant("s", "Supervisor nfs mount: media_test")), + ("What", Variant("s", "media.local:/media")), ], [], ), @@ -141,12 +141,12 @@ async def test_load( "mnt-data-supervisor-media-media_test.mount", "fail", [ - ["Options", Variant("s", "bind")], - [ + ("Options", Variant("s", "bind")), + ( "Description", Variant("s", "Supervisor bind mount: bind_media_test"), - ], - ["What", Variant("s", "/mnt/data/supervisor/mounts/media_test")], + ), + ("What", Variant("s", "/mnt/data/supervisor/mounts/media_test")), ], [], ), @@ -198,10 +198,10 @@ async def test_load_share_mount( "mnt-data-supervisor-mounts-share_test.mount", "fail", [ - ["Options", Variant("s", "soft,timeo=200")], - ["Type", Variant("s", "nfs")], - ["Description", Variant("s", "Supervisor nfs mount: share_test")], - ["What", Variant("s", "share.local:/share")], + ("Options", Variant("s", "soft,timeo=200")), + ("Type", Variant("s", "nfs")), + ("Description", Variant("s", "Supervisor nfs mount: share_test")), + ("What", Variant("s", "share.local:/share")), ], [], ), @@ -209,9 +209,9 @@ async def test_load_share_mount( "mnt-data-supervisor-share-share_test.mount", "fail", [ - ["Options", Variant("s", "bind")], - ["Description", Variant("s", "Supervisor bind mount: bind_share_test")], - ["What", Variant("s", "/mnt/data/supervisor/mounts/share_test")], + ("Options", Variant("s", "bind")), + ("Description", Variant("s", "Supervisor bind mount: bind_share_test")), + ("What", Variant("s", "/mnt/data/supervisor/mounts/share_test")), ], [], ), @@ -318,12 +318,12 @@ async def test_mount_failed_during_load( "mnt-data-supervisor-media-media_test.mount", "fail", [ - ["Options", Variant("s", "ro,bind")], - [ + ("Options", Variant("s", "ro,bind")), + ( "Description", Variant("s", "Supervisor bind mount: emergency_media_test"), - ], - ["What", Variant("s", "/mnt/data/supervisor/emergency/media_test")], + ), + ("What", Variant("s", "/mnt/data/supervisor/emergency/media_test")), ], [], ) @@ -634,10 +634,10 @@ async def test_reload_mounts_attempts_initial_mount( "mnt-data-supervisor-mounts-media_test.mount", "fail", [ - ["Options", Variant("s", "soft,timeo=200")], - ["Type", Variant("s", "nfs")], - ["Description", Variant("s", "Supervisor nfs mount: media_test")], - ["What", Variant("s", "media.local:/media")], + ("Options", Variant("s", "soft,timeo=200")), + ("Type", Variant("s", "nfs")), + ("Description", Variant("s", "Supervisor nfs mount: media_test")), + ("What", Variant("s", "media.local:/media")), ], [], ), @@ -645,9 +645,9 @@ async def test_reload_mounts_attempts_initial_mount( "mnt-data-supervisor-media-media_test.mount", "fail", [ - ["Options", Variant("s", "bind")], - ["Description", Variant("s", "Supervisor bind mount: bind_media_test")], - ["What", Variant("s", "/mnt/data/supervisor/mounts/media_test")], + ("Options", Variant("s", "bind")), + ("Description", Variant("s", "Supervisor bind mount: bind_media_test")), + ("What", Variant("s", "/mnt/data/supervisor/mounts/media_test")), ], [], ), diff --git a/tests/mounts/test_mount.py b/tests/mounts/test_mount.py index 830e1f5b4..e04672d3b 100644 --- a/tests/mounts/test_mount.py +++ b/tests/mounts/test_mount.py @@ -105,7 +105,7 @@ async def test_cifs_mount( "mnt-data-supervisor-mounts-test.mount", "fail", [ - [ + ( "Options", Variant( "s", @@ -117,10 +117,10 @@ async def test_cifs_mount( ] ), ), - ], - ["Type", Variant("s", "cifs")], - ["Description", Variant("s", "Supervisor cifs mount: test")], - ["What", Variant("s", "//test.local/camera")], + ), + ("Type", Variant("s", "cifs")), + ("Description", Variant("s", "Supervisor cifs mount: test")), + ("What", Variant("s", "//test.local/camera")), ], [], ) @@ -177,10 +177,10 @@ async def test_cifs_mount_read_only( "mnt-data-supervisor-mounts-test.mount", "fail", [ - ["Options", Variant("s", "ro,noserverino,guest")], - ["Type", Variant("s", "cifs")], - ["Description", Variant("s", "Supervisor cifs mount: test")], - ["What", Variant("s", "//test.local/camera")], + ("Options", Variant("s", "ro,noserverino,guest")), + ("Type", Variant("s", "cifs")), + ("Description", Variant("s", "Supervisor cifs mount: test")), + ("What", Variant("s", "//test.local/camera")), ], [], ) @@ -237,10 +237,10 @@ async def test_nfs_mount( "mnt-data-supervisor-mounts-test.mount", "fail", [ - ["Options", Variant("s", "port=1234,soft,timeo=200")], - ["Type", Variant("s", "nfs")], - ["Description", Variant("s", "Supervisor nfs mount: test")], - ["What", Variant("s", "test.local:/media/camera")], + ("Options", Variant("s", "port=1234,soft,timeo=200")), + ("Type", Variant("s", "nfs")), + ("Description", Variant("s", "Supervisor nfs mount: test")), + ("What", Variant("s", "test.local:/media/camera")), ], [], ) @@ -283,10 +283,10 @@ async def test_nfs_mount_read_only( "mnt-data-supervisor-mounts-test.mount", "fail", [ - ["Options", Variant("s", "ro,port=1234,soft,timeo=200")], - ["Type", Variant("s", "nfs")], - ["Description", Variant("s", "Supervisor nfs mount: test")], - ["What", Variant("s", "test.local:/media/camera")], + ("Options", Variant("s", "ro,port=1234,soft,timeo=200")), + ("Type", Variant("s", "nfs")), + ("Description", Variant("s", "Supervisor nfs mount: test")), + ("What", Variant("s", "test.local:/media/camera")), ], [], ) @@ -331,10 +331,10 @@ async def test_load( "mnt-data-supervisor-mounts-test.mount", "fail", [ - ["Options", Variant("s", "noserverino,guest")], - ["Type", Variant("s", "cifs")], - ["Description", Variant("s", "Supervisor cifs mount: test")], - ["What", Variant("s", "//test.local/share")], + ("Options", Variant("s", "noserverino,guest")), + ("Type", Variant("s", "cifs")), + ("Description", Variant("s", "Supervisor cifs mount: test")), + ("What", Variant("s", "//test.local/share")), ], [], ) @@ -736,10 +736,10 @@ async def test_mount_fails_if_down( "mnt-data-supervisor-mounts-test.mount", "fail", [ - ["Options", Variant("s", "port=1234,soft,timeo=200")], - ["Type", Variant("s", "nfs")], - ["Description", Variant("s", "Supervisor nfs mount: test")], - ["What", Variant("s", "test.local:/media/camera")], + ("Options", Variant("s", "port=1234,soft,timeo=200")), + ("Type", Variant("s", "nfs")), + ("Description", Variant("s", "Supervisor nfs mount: test")), + ("What", Variant("s", "test.local:/media/camera")), ], [], )