test-runner: add wait_for_dbus_service

Common API to wait for a DBus service to appear on the bus
This commit is contained in:
James Prestwood 2020-12-17 11:36:06 -08:00 committed by Denis Kenzior
parent 5525f32cdd
commit e8031bab2a
1 changed files with 9 additions and 0 deletions

View File

@ -616,6 +616,15 @@ class Namespace:
return False
def wait_for_dbus_service(self, service):
tries = 0
while not self._bus.name_has_owner(service):
if tries > 200:
raise TimeoutError('DBus service %s did not appear', service)
tries += 1
sleep(0.1)
def __str__(self):
ret = 'Namespace: %s\n' % self.name
ret += 'Processes:\n'