commit 23a22edaed0975acdb5f5e67e2bc8241afce64f2
parent 9efcea360498c3581ae8fb45e5830109e70a409c
Author: James Prestwood <prestwoj@gmail.com>
Date: Wed, 28 Sep 2022 09:36:35 -0700
auto-t: change wait_for_object_change behavior
Instead of requiring the initial condition be met when calling
wait_for_object_change, wait for it.
This is how every caller of this function uses it, specifically
with roaming where we first wait for DeviceState.roaming, then
call wait_for_object_change. This can be simplified for the caller
so the initial condition is first waited for.
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
@@ -1160,7 +1160,7 @@ class IWD(AsyncOpAbstract):
def wait_for_object_change(self, obj, from_str, to_str, max_wait = 50):
'''
- Expects condition 'from_str' to evaluate true while waiting for 'to_str'. If
+ Wait for 'from_str' to evaluate true then waits for 'to_str'. If
at any point during the wait 'from_str' evaluates false, an exception is
raised.
@@ -1180,9 +1180,8 @@ class IWD(AsyncOpAbstract):
return False
- # Does initial condition pass?
- if not eval(from_str):
- raise Exception("initial condition [%s] not met" % from_str)
+ # wait for initial condition
+ self._wait_for_object_condition(obj, from_str)
ctx.non_block_wait(_eval_from_to, max_wait, obj, from_str, to_str,
exception=TimeoutError('[' + to_str + ']'\