def test_once(timeout=6.0): with self.database.transaction(): self.assertIsNone(Initialized.lookupAny()) self.assertIsNone(Stopped.lookupAny()) ServiceManager.createOrUpdateService(WaitForService, svcName) ServiceManager.startService(svcName) ServiceManager.waitRunning(self.database, svcName, timeout=timeout) with self.database.view(): self.assertIsNotNone(Initialized.lookupAny()) with self.database.transaction(): ServiceManager.stopService(svcName) ServiceManager.waitStopped(self.database, svcName, timeout=timeout) with self.database.view(): self.assertIsNotNone(Stopped.lookupAny()) with self.database.transaction(): for obj in Initialized.lookupAll(): obj.delete() for obj in Stopped.lookupAll(): obj.delete()
def waitRunning(self, serviceName): self.assertTrue( ServiceManager.waitRunning(self.database, serviceName, self.WAIT_FOR_COUNT_TIMEOUT), "Service " + serviceName + " never came up.")