From b5cf270a2049563b0d0e04b81302e003e216acab Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Wed, 28 Feb 2024 20:33:42 -0600 Subject: [PATCH] trivial: drop some boilerplate setup code in the unit tests Use dbusmock's start_system_bus() to start and tear down the system bus. --- tests/integration_test.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/tests/integration_test.py b/tests/integration_test.py index 6fa03c6..8ec129b 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -99,21 +99,8 @@ class Tests(dbusmock.DBusTestCase): os.environ["G_DEBUG"] = "fatal_warnings" # set up a fake system D-BUS - cls.test_bus = Gio.TestDBus.new(Gio.TestDBusFlags.NONE) - cls.test_bus.up() - try: - del os.environ["DBUS_SESSION_BUS_ADDRESS"] - except KeyError: - pass - os.environ["DBUS_SYSTEM_BUS_ADDRESS"] = cls.test_bus.get_bus_address() - + cls.start_system_bus() cls.dbus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None) - cls.dbus_con = cls.get_dbus(True) - - @classmethod - def tearDownClass(cls): - cls.test_bus.down() - dbusmock.DBusTestCase.tearDownClass() def setUp(self): """Set up a local umockdev testbed.