File tree 1 file changed +12
-3
lines changed
src/controller/python/test/test_scripts
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1284,9 +1284,18 @@ async def _conductAttributeChange(devCtrl: ChipDeviceCtrl.ChipDeviceController,
1284
1284
"Failed to receive subscription update" )
1285
1285
break
1286
1286
1287
- # thread changes 5 times, and sleeps for 3 seconds in between.
1288
- # Add an additional 3 seconds of slack. Timeout is in seconds.
1289
- await asyncio .wait_for (taskAttributeChange , 3 )
1287
+ # At this point the task should really have done the three attribute,
1288
+ # otherwise something is wrong. Wait for just 1s in case of a race
1289
+ # condition between the last attribute update and the callback.
1290
+ try :
1291
+ await asyncio .wait_for (taskAttributeChange , 1 )
1292
+ except asyncio .TimeoutError :
1293
+ # If attribute change task did not finish something is wrong. Cancel
1294
+ # the task.
1295
+ taskAttributeChange .cancel ()
1296
+ # This will throw a asyncio.CancelledError and makes sure the test
1297
+ # is declared failed.
1298
+ await taskAttributeChange
1290
1299
1291
1300
return True if receivedUpdate == 5 else False
1292
1301
You can’t perform that action at this time.
0 commit comments