3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:39:25 +01:00

auto-t: ead.py: remove wait_for_object_condition

Instead the class method IWD._wait_for_object_condition can
be used.
This commit is contained in:
James Prestwood 2021-08-13 13:26:10 -07:00 committed by Denis Kenzior
parent 382b73c11a
commit 365f955318
2 changed files with 2 additions and 21 deletions

View File

@ -22,10 +22,10 @@ class Test(unittest.TestCase):
adapter = ead.list_adapters(1)[0]
condition = 'obj.connected == True'
ead.wait_for_object_condition(adapter, condition)
IWD._wait_for_object_condition(adapter, condition)
condition = 'obj.authenticated == True'
ead.wait_for_object_condition(adapter, condition)
IWD._wait_for_object_condition(adapter, condition)
ctx.stop_process(p)
@classmethod

View File

@ -103,22 +103,3 @@ class EAD(iwd.AsyncOpAbstract):
exception=TimeoutError('EAD has no associated devices'))
return list(self._adapters.values())
def wait_for_object_condition(self, obj, condition_str, max_wait = 50):
self._wait_timed_out = False
def wait_timeout_cb():
self._wait_timed_out = True
return False
try:
timeout = GLib.timeout_add_seconds(max_wait, wait_timeout_cb)
context = ctx.mainloop.get_context()
while not eval(condition_str):
context.iteration(may_block=True)
if self._wait_timed_out and ctx.args.gdb == None:
raise TimeoutError('[' + condition_str + ']'\
' condition was not met in '\
+ str(max_wait) + ' sec')
finally:
if not self._wait_timed_out:
GLib.source_remove(timeout)