From 5a9d2df5751511729fe098e682fdd0ebddec69b3 Mon Sep 17 00:00:00 2001 From: knuxify Date: Wed, 8 May 2024 16:31:06 +0200 Subject: [PATCH] Inherit from DBusTestCase directly in DNS provider test This allows the DBus mock server to be properly torn down once the tests are done running. DBusTestCase inherits from unittest.TestCase, so it remains functionally identical. --- test/main/test_dns_server_provider.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/main/test_dns_server_provider.py b/test/main/test_dns_server_provider.py index 0335f2674..1de3dd0c3 100644 --- a/test/main/test_dns_server_provider.py +++ b/test/main/test_dns_server_provider.py @@ -1,6 +1,5 @@ from ipaddress import IPv4Address from typing import Callable -from unittest import TestCase from unittest.mock import patch, Mock from dbusmock import DBusTestCase @@ -18,10 +17,10 @@ Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION | Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT, ) ) -class TestDNSServerProvider(TestCase): +class TestDNSServerProvider(DBusTestCase): @classmethod def setUpClass(cls) -> None: - DBusTestCase.start_system_bus() + cls.start_system_bus() def test_resolver(self): with open("/tmp/resolv.conf", "w") as f: