mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
tests/fprintd: Use addCleanup to always terminate daemons
Ensure that the daemons are always terminated after each test, even on failure, so that we don't have to do hacks such as always trying to stop them
This commit is contained in:
committed by
Bastien Nocera
parent
cefe939141
commit
a8de1003a4
@ -191,6 +191,7 @@ class FPrintdTest(dbusmock.DBusTestCase):
|
||||
env=env,
|
||||
stdout=None,
|
||||
stderr=subprocess.STDOUT)
|
||||
self.addCleanup(self.daemon_stop)
|
||||
|
||||
timeout_count = timeout * 10
|
||||
timeout_sleep = 0.1
|
||||
@ -245,6 +246,7 @@ class FPrintdTest(dbusmock.DBusTestCase):
|
||||
def polkitd_start(self):
|
||||
self._polkitd, self._polkitd_obj = self.spawn_server_template(
|
||||
'polkitd', {}, stdout=DEVNULL)
|
||||
self.addCleanup(self.polkitd_stop)
|
||||
|
||||
def polkitd_stop(self):
|
||||
if self._polkitd is None:
|
||||
@ -288,8 +290,6 @@ class FPrintdVirtualDeviceTest(FPrintdTest):
|
||||
self.daemon_start()
|
||||
|
||||
if self.device is None:
|
||||
self.daemon_stop()
|
||||
self.polkitd_stop()
|
||||
self.skipTest("Need virtual_image device to run the test")
|
||||
|
||||
self._polkitd_obj.SetAllowed(['net.reactivated.fprint.device.setusername',
|
||||
@ -326,9 +326,6 @@ class FPrintdVirtualDeviceTest(FPrintdTest):
|
||||
def tearDown(self):
|
||||
self.device.disconnect(self.g_signal_id)
|
||||
|
||||
self.daemon_stop()
|
||||
self.polkitd_stop()
|
||||
|
||||
del self.manager
|
||||
del self.device
|
||||
|
||||
|
||||
Reference in New Issue
Block a user