From ea7b4e82b5ce867adeaeb0e373f6d311693b38c2 Mon Sep 17 00:00:00 2001 From: Noemi Frisina <54588199+noemifrisina@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:00:35 +0100 Subject: [PATCH] Use pmac abort program (#466) * Use pmac abort * repin dodal * Update test --- pyproject.toml | 2 +- .../fixed_target/i24ssx_Chip_Collect_py3v1.py | 4 +--- .../i24/serial/fixed_target/test_ft_collect.py | 13 +++---------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 85e4f9f2b..78ffecba7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ dependencies = [ "ophyd == 1.9.0", "ophyd-async >= 0.3a5", "bluesky >= 1.13.0a4", - "dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@5e8b6fc2933a2b2b2e788d432c8408317ac4a5cc", + "dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@dadbe02e15a8325fef44c8619dae4569e98a56cb", ] diff --git a/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py b/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py index 7a75b5dca..5ccd528a2 100755 --- a/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +++ b/src/mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py @@ -609,9 +609,7 @@ def run_aborted_plan(pmac: PMAC, dcid: DCID): P variable. """ logger.warning("Data Collection Aborted") - yield from bps.abs_set(pmac.pmac_string, "A", wait=True) - yield from bps.sleep(1.0) - yield from bps.abs_set(pmac.pmac_string, "P2401=0", wait=True) + yield from bps.trigger(pmac.abort_program, wait=True) end_time = datetime.now() dcid.collection_complete(end_time, aborted=True) diff --git a/tests/unit_tests/beamlines/i24/serial/fixed_target/test_ft_collect.py b/tests/unit_tests/beamlines/i24/serial/fixed_target/test_ft_collect.py index 28c561477..b0bde74c1 100644 --- a/tests/unit_tests/beamlines/i24/serial/fixed_target/test_ft_collect.py +++ b/tests/unit_tests/beamlines/i24/serial/fixed_target/test_ft_collect.py @@ -209,18 +209,11 @@ def test_finish_i24( @patch("mx_bluesky.beamlines.i24.serial.fixed_target.i24ssx_Chip_Collect_py3v1.DCID") -@patch( - "mx_bluesky.beamlines.i24.serial.fixed_target.i24ssx_Chip_Collect_py3v1.bps.sleep" -) -def test_run_aborted_plan(mock_sleep, fake_dcid: MagicMock, pmac: PMAC, RE): +def test_run_aborted_plan(fake_dcid: MagicMock, pmac: PMAC, RE, done_status): + pmac.abort_program.trigger = MagicMock(return_value=done_status) RE(run_aborted_plan(pmac, fake_dcid)) - mock_pmac_string = get_mock_put(pmac.pmac_string) - pmac_string_calls = [ - call("A", wait=True, timeout=ANY), - call("P2401=0", wait=True, timeout=ANY), - ] - mock_pmac_string.assert_has_calls(pmac_string_calls) + pmac.abort_program.trigger.assert_called_once() fake_dcid.collection_complete.assert_called_once_with(ANY, aborted=True)