Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring committed May 17, 2024
1 parent ecd6ab0 commit 0a0031e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions api/tests/opentrons/protocol_engine/state/test_command_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,3 +469,33 @@ def test_final_state_after_estop() -> None:

assert subject_view.get_status() == EngineStatus.FAILED
assert subject_view.get_error() == expected_error_occurrence


def test_final_state_after_stop() -> None:
"""Test the final state of the run after it's stopped."""
subject = CommandStore(config=_make_config(), is_door_open=False)
subject_view = CommandView(subject.state)

subject.handle_action(actions.StopAction())
subject.handle_action(
actions.FinishAction(
error_details=actions.FinishErrorDetails(
error=RuntimeError(
"uh oh I was a command and then I got cancelled because someone"
" stopped the run, and now I'm raising this exception because"
" of that. Woe is me"
),
error_id="error-id",
created_at=datetime.now(),
)
)
)
subject.handle_action(
actions.HardwareStoppedAction(
completed_at=sentinel.hardware_stopped_action_completed_at,
finish_error_details=None,
)
)

assert subject_view.get_status() == EngineStatus.STOPPED
assert subject_view.get_error() is None

0 comments on commit 0a0031e

Please sign in to comment.