From 1fece5f546566215d6b132348df799061d0b5b33 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 15 Nov 2018 15:57:23 -0800 Subject: [PATCH] [toranj] update test-603 to use verify_within() (#3306) --- .../test-603-channel-manager-announce-recovery.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/toranj/test-603-channel-manager-announce-recovery.py b/tests/toranj/test-603-channel-manager-announce-recovery.py index bc8b2adb7..0724d68ed 100644 --- a/tests/toranj/test-603-channel-manager-announce-recovery.py +++ b/tests/toranj/test-603-channel-manager-announce-recovery.py @@ -98,16 +98,12 @@ c2.reset(); verify(int(c2.get(wpan.WPAN_CHANNEL), 0) == 11) # wait for 20s for c2 to be attached/associated -start_time = time.time() -wait_time = 20 +def check_c2_is_associated(): + verify(c2.is_associated()) -while not c2.is_associated(): - if time.time() - start_time > wait_time: - print 'Took too long to recover through ML Announce ({}>{} sec)'.format(time.time() - start_time, wait_time) - exit(1) - time.sleep(0.1) +wpan.verify_within(check_c2_is_associated, 20) -# Check that c2 did attach and is on channel 26. +# Check that c2 is now on channel 26. verify(int(c2.get(wpan.WPAN_CHANNEL), 0) == 26) #-----------------------------------------------------------------------------------------------------------------------