From c5249d3f1dcf0b37bfded9afba1356de7a3205b9 Mon Sep 17 00:00:00 2001 From: tamarzanzouri Date: Wed, 3 Apr 2024 18:33:37 -0400 Subject: [PATCH] fixed logic with test --- api/src/opentrons/protocol_runner/protocol_runner.py | 2 ++ .../opentrons/protocol_runner/test_protocol_runner.py | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/api/src/opentrons/protocol_runner/protocol_runner.py b/api/src/opentrons/protocol_runner/protocol_runner.py index 6e8a10e26a1..63108740db5 100644 --- a/api/src/opentrons/protocol_runner/protocol_runner.py +++ b/api/src/opentrons/protocol_runner/protocol_runner.py @@ -365,6 +365,8 @@ async def _add_command_and_execute(self) -> None: original_error=result.error, message=f"{result.error.errorType}: {result.error.detail}", ) + elif result.status == pe_commands.CommandStatus.QUEUED: + break class LiveRunner(AbstractRunner): diff --git a/api/tests/opentrons/protocol_runner/test_protocol_runner.py b/api/tests/opentrons/protocol_runner/test_protocol_runner.py index 12b0445045e..f7fc998d00f 100644 --- a/api/tests/opentrons/protocol_runner/test_protocol_runner.py +++ b/api/tests/opentrons/protocol_runner/test_protocol_runner.py @@ -377,6 +377,13 @@ async def test_run_json_runner_stop_requested_stops_enquqing( decoy.when(json_file_reader.read(json_protocol_source)).then_return(json_protocol) decoy.when(json_translator.translate_commands(json_protocol)).then_return(commands) decoy.when(json_translator.translate_liquids(json_protocol)).then_return(liquids) + decoy.when( + await protocol_engine.add_and_execute_command( + pe_commands.HomeCreate(params=pe_commands.HomeParams()), + ) + ).then_return( + pe_commands.Home.construct(status=pe_commands.CommandStatus.SUCCEEDED) # type: ignore[call-arg] + ) decoy.when( await protocol_engine.add_and_execute_command( pe_commands.WaitForDurationCreate(