@@ -638,6 +638,41 @@ def test_command_store_handles_stop_action(
638
638
assert subject .state .command_history .get_setup_queue_ids () == OrderedSet ()
639
639
640
640
641
+ def test_command_store_handles_stop_action_when_awaiting_recovery () -> None :
642
+ """It should mark the engine as non-gracefully stopped on StopAction."""
643
+ subject = CommandStore (is_door_open = False , config = _make_config ())
644
+
645
+ subject .handle_action (
646
+ PlayAction (
647
+ requested_at = datetime (year = 2021 , month = 1 , day = 1 ), deck_configuration = []
648
+ )
649
+ )
650
+
651
+ subject .state .queue_status = QueueStatus .AWAITING_RECOVERY
652
+
653
+ subject .handle_action (StopAction ())
654
+
655
+ assert subject .state == CommandState (
656
+ command_history = CommandHistory (),
657
+ queue_status = QueueStatus .PAUSED ,
658
+ run_result = RunResult .STOPPED ,
659
+ run_completed_at = None ,
660
+ is_door_blocking = False ,
661
+ run_error = None ,
662
+ finish_error = None ,
663
+ failed_command = None ,
664
+ command_error_recovery_types = {},
665
+ recovery_target_command_id = None ,
666
+ run_started_at = datetime (year = 2021 , month = 1 , day = 1 ),
667
+ latest_protocol_command_hash = None ,
668
+ stopped_by_estop = False ,
669
+ )
670
+ assert subject .state .command_history .get_running_command () is None
671
+ assert subject .state .command_history .get_all_ids () == []
672
+ assert subject .state .command_history .get_queue_ids () == OrderedSet ()
673
+ assert subject .state .command_history .get_setup_queue_ids () == OrderedSet ()
674
+
675
+
641
676
def test_command_store_cannot_restart_after_should_stop () -> None :
642
677
"""It should reject a play action after finish."""
643
678
subject = CommandStore (is_door_open = False , config = _make_config ())
0 commit comments