commit 365f955318e3df94c2d463f4f806ac6396b85ebf
parent 382b73c11adf0b64b95baa2a4e756dd24c42574a
Author: James Prestwood <prestwoj@gmail.com>
Date: Fri, 13 Aug 2021 13:26:10 -0700
auto-t: ead.py: remove wait_for_object_condition
Instead the class method IWD._wait_for_object_condition can
be used.
Diffstat:
2 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/autotests/testEAD/connection_test.py b/autotests/testEAD/connection_test.py
@@ -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
diff --git a/autotests/util/ead.py b/autotests/util/ead.py
@@ -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)