From 920e79b32caf4535ae5c12914b28b7859c0b4e0f Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Sun, 14 May 2017 04:10:06 +0200 Subject: [PATCH] autotests: Add IWD.wait utility for sleeping inside tests --- autotests/util/iwd.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index bb1f70cd..70000034 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -589,6 +589,17 @@ class IWD(AsyncOpAbstract): + str(max_wait) + ' sec') GLib.source_remove(timeout) + def wait(self, time): + self._wait_timed_out = False + def wait_timeout_cb(): + self._wait_timed_out = True + return False + + GLib.timeout_add(int(time * 1000), wait_timeout_cb) + context = mainloop.get_context() + while not self._wait_timed_out: + context.iteration(may_block=True) + @staticmethod def clear_storage(): os.system('rm -rf ' + IWD_STORAGE_DIR + '/*')