Sometimes the client's GDBusObjectManager does not refresh properly and keeps
around objects which have long gone, which leads to a timeout in waiting for
the device object to disappear. Presumably this is because the test suite does
not run a main loop, and we cannot currently access
g_main_context_get_default() from introspection. So instead, just generate a
fresh client.
if self.client.get_object(path) is None:
break
timeout -= 1
+ # we do not have a main loop, and cannot currently use
+ # g_main_context_get_default() from introspection, so
+ # instead of refreshing self.client, get a new one
+ self.client = UDisks.Client.new_sync(None)
time.sleep(0.1)
self.assertGreater(timeout, 0, 'timeout waiting for object path %s to disappear' % path)
finally: