From 365f955318e3df94c2d463f4f806ac6396b85ebf Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Fri, 13 Aug 2021 13:26:10 -0700 Subject: [PATCH] auto-t: ead.py: remove wait_for_object_condition Instead the class method IWD._wait_for_object_condition can be used. --- autotests/testEAD/connection_test.py | 4 ++-- autotests/util/ead.py | 19 ------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/autotests/testEAD/connection_test.py b/autotests/testEAD/connection_test.py index 7f23f0d6..a858831d 100644 --- 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 index 8f333a8a..06716914 100644 --- 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)