File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
zwave_js_server/model/node Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -407,6 +407,25 @@ async def async_send_command(
407407 assert task_2 .done ()
408408 assert task_2 .result () is None
409409
410+ # mark node as alive
411+ event = Event (type = "alive" )
412+ node .handle_alive (event )
413+ task = asyncio .create_task (node .async_send_command ("mock_cmd" ))
414+ task_2 = asyncio .create_task (node .endpoints [0 ].async_send_command ("mock_cmd" ))
415+ await asyncio .sleep (0.01 )
416+ # we are waiting for the response
417+ assert not task .done ()
418+ assert not task_2 .done ()
419+ # node is marked dead
420+ event = Event (type = "dead" )
421+ node .handle_dead (event )
422+ await asyncio .sleep (0.01 )
423+ # we are no longer waiting for the response
424+ assert task .done ()
425+ assert task .result () is None
426+ assert task_2 .done ()
427+ assert task_2 .result () is None
428+
410429
411430async def test_poll_value (multisensor_6 , uuid4 , mock_command ):
412431 """Test poll value."""
Original file line number Diff line number Diff line change @@ -503,10 +503,7 @@ async def async_send_command(
503503 if wait_for_result :
504504 result = await self .client .async_send_command (message , ** kwargs )
505505 return result
506- if wait_for_result is None and self .status not in (
507- NodeStatus .ASLEEP ,
508- NodeStatus .DEAD ,
509- ):
506+ if wait_for_result is None and self .status not in (NodeStatus .ASLEEP ,):
510507 result_task = asyncio .create_task (
511508 self .client .async_send_command (message , ** kwargs )
512509 )
You can’t perform that action at this time.
0 commit comments