diff --git a/src/mx_bluesky/I24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py b/src/mx_bluesky/I24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py index 8393caaae..420582303 100755 --- a/src/mx_bluesky/I24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +++ b/src/mx_bluesky/I24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py @@ -380,9 +380,7 @@ def run_main_extruder_plan( ABORTED = False -def run_aborted_plan( - zebra: Zebra, shutter: HutchShutter, detector_name: str -) -> MsgGenerator: +def run_aborted_plan(zebra: Zebra, detector_name: str) -> MsgGenerator: """A plan to tidy up things in case the collection is aborted before the end.""" global ABORTED ABORTED = True @@ -393,7 +391,6 @@ def run_aborted_plan( elif detector_name == "eiger": caput(pv.eiger_acquire, 0) sleep(1.0) - yield from bps.null() def tidy_up_at_collection_end_plan( @@ -402,7 +399,7 @@ def tidy_up_at_collection_end_plan( parameters: ExtruderParameters, dcid: DCID, ) -> MsgGenerator: - """A plan to tidy up at the end of a collection. + """A plan to tidy up at the end of a collection, successful or aborted. Args: zebra (Zebra): The Zebra device. @@ -478,7 +475,7 @@ def run_extruder_plan( start_time, ), except_plan=lambda e: ( - yield from run_aborted_plan(zebra, shutter, parameters.detector_name) + yield from run_aborted_plan(zebra, parameters.detector_name) ), # TODO complete final_plan=lambda: ( yield from tidy_up_at_collection_end_plan(zebra, shutter, parameters, dcid) diff --git a/tests/I24/serial/extruder/test_extruder_collect.py b/tests/I24/serial/extruder/test_extruder_collect.py index 1ed5acd18..81c38c876 100644 --- a/tests/I24/serial/extruder/test_extruder_collect.py +++ b/tests/I24/serial/extruder/test_extruder_collect.py @@ -11,6 +11,7 @@ enter_hutch, initialise_extruder, laser_check, + run_aborted_plan, run_main_extruder_plan, tidy_up_at_collection_end_plan, ) @@ -254,3 +255,13 @@ def test_tidy_up_at_collection_end_plan_with_eiger( fake_caput.assert_has_calls(call_list) fake_sup.eiger.assert_called_once_with("return-to-normal") + + +@patch("mx_bluesky.I24.serial.extruder.i24ssx_Extruder_Collect_py3v2.sleep") +@patch("mx_bluesky.I24.serial.extruder.i24ssx_Extruder_Collect_py3v2.caput") +@patch("mx_bluesky.I24.serial.extruder.i24ssx_Extruder_Collect_py3v2.disarm_zebra") +def test_run_aborted_plan_with_pilatus(mock_disarm, fake_caput, fake_sleep, RE, zebra): + RE(run_aborted_plan(zebra, "pilatus")) + + mock_disarm.assert_called_once() + fake_caput.assert_has_calls([call(ANY, 0)])