Skip to content

Commit 6368b5f

Browse files
whotmartinpitt
authored andcommitted
testcase: switch to seconds from deciseconds
deciseconds is a rather unusual unit. Let's switch the real API we now have to use seconds: float like time.sleep() and wrap our old API around that.
1 parent a049f9a commit 6368b5f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

dbusmock/testcase.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@ def reload_configuration(self):
6666
dbus_if = dbus.Interface(dbus_obj, 'org.freedesktop.DBus')
6767
dbus_if.ReloadConfig()
6868

69-
def wait_for_bus_object(self, dest: str, path: str, timeout: int = 600):
69+
def wait_for_bus_object(self, dest: str, path: str, timeout: float = 60.0):
7070
'''Wait for an object to appear on D-Bus
7171
7272
Raise an exception if object does not appear within one minute. You can
73-
change the timeout with the "timeout" keyword argument which specifies
74-
deciseconds.
73+
change the timeout in seconds with the "timeout" keyword argument.
7574
'''
7675
bus = self.get_connection()
7776

@@ -91,7 +90,7 @@ def wait_for_bus_object(self, dest: str, path: str, timeout: int = 600):
9190
if '.UnknownInterface' in str(e):
9291
break
9392

94-
timeout -= 1
93+
timeout -= 0.1
9594
time.sleep(0.1)
9695
if timeout <= 0:
9796
assert timeout > 0, f'timed out waiting for D-Bus object {path}: {last_exc}'
@@ -380,7 +379,7 @@ def wait_for_bus_object(dest: str, path: str, system_bus: bool = False, timeout:
380379
BusType.wait_for_bus_object() instead.
381380
'''
382381
bustype = BusType.SYSTEM if system_bus else BusType.SESSION
383-
bustype.wait_for_bus_object(dest, path, timeout)
382+
bustype.wait_for_bus_object(dest, path, timeout / 10.0)
384383

385384
@staticmethod
386385
def spawn_server(name: str, path: str, interface: str, system_bus: bool = False, stdout=None) -> subprocess.Popen:

0 commit comments

Comments
 (0)