diff --git a/src/hyperion/__main__.py b/src/hyperion/__main__.py index e18dd84f2..c4a354f66 100755 --- a/src/hyperion/__main__.py +++ b/src/hyperion/__main__.py @@ -228,7 +228,7 @@ def compose_start_args(context: BlueskyContext, plan_name: str, action: Actions) parameters = experiment_internal_param_type(**json.loads(request.data)) except Exception as e: raise ValueError( - "Supplied parameters don't match the plan for this endpoint" + f"Supplied parameters don't match the plan for this endpoint {request.data}" ) from e return plan, parameters, plan_name, callback_type diff --git a/src/hyperion/device_setup_plans/setup_panda.py b/src/hyperion/device_setup_plans/setup_panda.py index 6d24fc2df..1bd344885 100644 --- a/src/hyperion/device_setup_plans/setup_panda.py +++ b/src/hyperion/device_setup_plans/setup_panda.py @@ -151,6 +151,8 @@ def setup_panda_for_flyscan( assert time_between_x_steps_ms * 1000 >= exposure_time_s assert sample_velocity_mm_per_s * exposure_time_s < parameters.x_step_size + yield from bps.stage(panda, group="panda-config") + with resources.as_file( resources.files(hyperion.resources.panda) / "panda-gridscan.yaml" ) as config_yaml_path: diff --git a/src/hyperion/experiment_plans/flyscan_xray_centre_plan.py b/src/hyperion/experiment_plans/flyscan_xray_centre_plan.py index b44d89344..34e5114b1 100755 --- a/src/hyperion/experiment_plans/flyscan_xray_centre_plan.py +++ b/src/hyperion/experiment_plans/flyscan_xray_centre_plan.py @@ -467,6 +467,7 @@ def _panda_tidy(fgs_composite: FlyScanXRayCentreComposite): yield from disarm_panda_for_gridscan(fgs_composite.panda, group) yield from _generic_tidy(fgs_composite, group, False) yield from bps.wait(group, timeout=10) + yield from bps.unstage(fgs_composite.panda) def _zebra_triggering_setup( diff --git a/src/hyperion/experiment_plans/oav_snapshot_plan.py b/src/hyperion/experiment_plans/oav_snapshot_plan.py index b6887a9c2..e92033c55 100644 --- a/src/hyperion/experiment_plans/oav_snapshot_plan.py +++ b/src/hyperion/experiment_plans/oav_snapshot_plan.py @@ -3,7 +3,7 @@ from blueapi.core import MsgGenerator from bluesky import plan_stubs as bps -from dodal.devices.aperturescatterguard import AperturePositions, ApertureScatterguard +from dodal.devices.aperturescatterguard import ApertureScatterguard from dodal.devices.backlight import Backlight, BacklightPosition from dodal.devices.oav.oav_detector import OAV from dodal.devices.oav.oav_parameters import OAVParameters @@ -39,9 +39,10 @@ def setup_oav_snapshot_plan( yield from bps.abs_set( composite.backlight, BacklightPosition.IN, group=OAV_SNAPSHOT_SETUP_GROUP ) + assert composite.aperture_scatterguard.aperture_positions is not None yield from bps.abs_set( composite.aperture_scatterguard, - AperturePositions.ROBOT_LOAD, + composite.aperture_scatterguard.aperture_positions.ROBOT_LOAD, group=OAV_SNAPSHOT_SETUP_GROUP, ) diff --git a/src/hyperion/resources/panda/panda-gridscan.yaml b/src/hyperion/resources/panda/panda-gridscan.yaml index 2166865cf..337dad0e9 100644 --- a/src/hyperion/resources/panda/panda-gridscan.yaml +++ b/src/hyperion/resources/panda/panda-gridscan.yaml @@ -42,7 +42,7 @@ pulse.4.delay_units: s pulse.4.step_units: s pulse.4.width_units: s - seq.1.prescale_units: s + seq.1.prescale_units: us seq.2.prescale_units: s sfp3_sync_in.pos1_units: '' sfp3_sync_in.pos2_units: '' @@ -211,13 +211,6 @@ counter.8.step: 0.0 counter.8.trig: ZERO counter.8.trig_delay: 0 - data.capture: false - data.capture_mode: FIRST_N - data.createdirectory: 0 - data.flush_period: 1.0 - data.hdf_directory: '' - data.hdf_file_name: '' - data.num_capture: 0 div.1.divisor: 0.0 div.1.enable: ZERO div.1.enable_delay: 0 @@ -308,7 +301,7 @@ inenc.2.protocol: Quadrature inenc.2.rst_on_z: '0' inenc.2.setp: 0 - inenc.2.val_capture: 'No' + inenc.2.val_capture: Min Max Mean inenc.2.val_dataset: '' inenc.2.val_offset: 0.0 inenc.2.val_scale: 5.0e-06 @@ -324,7 +317,7 @@ inenc.3.protocol: Quadrature inenc.3.rst_on_z: '0' inenc.3.setp: 0 - inenc.3.val_capture: 'No' + inenc.3.val_capture: Min Max Mean inenc.3.val_dataset: '' inenc.3.val_offset: 0.0 inenc.3.val_scale: 5.0e-06 @@ -676,7 +669,7 @@ seq.1.posa: INENC1.VAL seq.1.posb: ZERO seq.1.posc: ZERO - seq.1.prescale: 0.0 + seq.1.prescale: 1.0 seq.1.repeats: 0.0 seq.1.table: outa1: [0, 1, 0, 0, 1, 0] diff --git a/tests/conftest.py b/tests/conftest.py index 27099cbe3..053145e78 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,6 +9,7 @@ from unittest.mock import MagicMock, patch import bluesky.plan_stubs as bps +import numpy as np import pytest from bluesky.run_engine import RunEngine from bluesky.simulators import RunEngineSimulator @@ -53,6 +54,7 @@ from ophyd_async.core.async_status import AsyncStatus from ophyd_async.epics.motion.motor import Motor from ophyd_async.epics.signal import epics_signal_rw +from ophyd_async.panda._common_blocks import DatasetTable from scanspec.core import Path as ScanPath from scanspec.specs import Line @@ -648,6 +650,11 @@ async def create_mock_signals(devices_and_signals: dict[Device, dict[str, Any]]) **{panda.pulse[i]: {"enable": str} for i in panda.pulse.keys()}, } ) + + set_mock_value( + panda.data.datasets, DatasetTable(name=np.array(["name"]), hdf5_type=[]) + ) + return panda diff --git a/tests/unit_tests/experiment_plans/test_flyscan_xray_centre_plan.py b/tests/unit_tests/experiment_plans/test_flyscan_xray_centre_plan.py index 180a3ba23..8d0e9f47e 100644 --- a/tests/unit_tests/experiment_plans/test_flyscan_xray_centre_plan.py +++ b/tests/unit_tests/experiment_plans/test_flyscan_xray_centre_plan.py @@ -20,6 +20,7 @@ from dodal.devices.zocalo import ZocaloStartInfo from ophyd.status import Status from ophyd_async.core import set_mock_value +from ophyd_async.panda._table import DatasetTable from hyperion.device_setup_plans.read_hardware_for_setup import ( read_hardware_during_collection, @@ -81,6 +82,21 @@ ReWithSubs = tuple[RunEngine, Tuple[GridscanNexusFileCallback, GridscanISPyBCallback]] +@pytest.fixture +def fgs_composite_with_panda_pcap(fake_fgs_composite: FlyScanXRayCentreComposite): + capture_table = DatasetTable(name=np.array(["name"]), hdf5_type=[]) + set_mock_value(fake_fgs_composite.panda.data.datasets, capture_table) + + return fake_fgs_composite + + +@pytest.fixture +def fgs_params_use_panda(test_fgs_params: ThreeDGridScan, feature_flags: FeatureFlags): + feature_flags.use_panda_for_gridscan = True + test_fgs_params.features = feature_flags + return test_fgs_params + + @pytest.fixture(params=[True, False], ids=["panda", "zebra"]) def test_fgs_params_panda_zebra( request: pytest.FixtureRequest, @@ -126,11 +142,16 @@ def mock_ispyb(): return MagicMock() +def _custom_msg(command_name: str): + return lambda *args, **kwargs: iter([Msg(command_name)]) + + @patch( "hyperion.external_interaction.callbacks.xray_centre.ispyb_callback.StoreInIspyb", modified_store_grid_scan_mock, ) class TestFlyscanXrayCentrePlan: + td: TestData = TestData() def test_eiger2_x_16_detector_specified( @@ -295,44 +316,53 @@ def test_results_adjusted_and_passed_to_move_xyz( move_x_y_z: MagicMock, run_gridscan: MagicMock, move_aperture: MagicMock, - fake_fgs_composite: FlyScanXRayCentreComposite, + fgs_composite_with_panda_pcap: FlyScanXRayCentreComposite, test_fgs_params_panda_zebra: ThreeDGridScan, RE_with_subs: ReWithSubs, ): feature_controlled = _get_feature_controlled( - fake_fgs_composite, + fgs_composite_with_panda_pcap, test_fgs_params_panda_zebra, ) RE, _ = RE_with_subs RE.subscribe(VerbosePlanExecutionLoggingCallback()) - mock_zocalo_trigger(fake_fgs_composite.zocalo, TEST_RESULT_LARGE) + mock_zocalo_trigger(fgs_composite_with_panda_pcap.zocalo, TEST_RESULT_LARGE) RE( run_gridscan_and_move( - fake_fgs_composite, test_fgs_params_panda_zebra, feature_controlled + fgs_composite_with_panda_pcap, + test_fgs_params_panda_zebra, + feature_controlled, ) ) - mock_zocalo_trigger(fake_fgs_composite.zocalo, TEST_RESULT_MEDIUM) + mock_zocalo_trigger(fgs_composite_with_panda_pcap.zocalo, TEST_RESULT_MEDIUM) RE( run_gridscan_and_move( - fake_fgs_composite, test_fgs_params_panda_zebra, feature_controlled + fgs_composite_with_panda_pcap, + test_fgs_params_panda_zebra, + feature_controlled, ) ) - mock_zocalo_trigger(fake_fgs_composite.zocalo, TEST_RESULT_SMALL) + mock_zocalo_trigger(fgs_composite_with_panda_pcap.zocalo, TEST_RESULT_SMALL) RE( run_gridscan_and_move( - fake_fgs_composite, test_fgs_params_panda_zebra, feature_controlled + fgs_composite_with_panda_pcap, + test_fgs_params_panda_zebra, + feature_controlled, ) ) - assert fake_fgs_composite.aperture_scatterguard.aperture_positions is not None + assert ( + fgs_composite_with_panda_pcap.aperture_scatterguard.aperture_positions + is not None + ) ap_call_large = call( - fake_fgs_composite.aperture_scatterguard.aperture_positions.LARGE.location + fgs_composite_with_panda_pcap.aperture_scatterguard.aperture_positions.LARGE.location ) ap_call_medium = call( - fake_fgs_composite.aperture_scatterguard.aperture_positions.MEDIUM.location + fgs_composite_with_panda_pcap.aperture_scatterguard.aperture_positions.MEDIUM.location ) move_aperture.assert_has_calls( @@ -340,10 +370,18 @@ def test_results_adjusted_and_passed_to_move_xyz( ) mv_call_large = call( - fake_fgs_composite.sample_motors, 0.05, pytest.approx(0.15), 0.25, wait=True + fgs_composite_with_panda_pcap.sample_motors, + 0.05, + pytest.approx(0.15), + 0.25, + wait=True, ) mv_call_medium = call( - fake_fgs_composite.sample_motors, 0.05, pytest.approx(0.15), 0.25, wait=True + fgs_composite_with_panda_pcap.sample_motors, + 0.05, + pytest.approx(0.15), + 0.25, + wait=True, ) move_x_y_z.assert_has_calls( [mv_call_large, mv_call_large, mv_call_medium], any_order=True @@ -404,18 +442,20 @@ def test_individual_plans_triggered_once_and_only_once_in_composite_run( run_gridscan: MagicMock, move_aperture: MagicMock, RE_with_subs: ReWithSubs, - fake_fgs_composite: FlyScanXRayCentreComposite, + fgs_composite_with_panda_pcap: FlyScanXRayCentreComposite, test_fgs_params_panda_zebra: ThreeDGridScan, ): RE, (_, ispyb_cb) = RE_with_subs feature_controlled = _get_feature_controlled( - fake_fgs_composite, test_fgs_params_panda_zebra + fgs_composite_with_panda_pcap, test_fgs_params_panda_zebra ) def wrapped_gridscan_and_move(): run_generic_ispyb_handler_setup(ispyb_cb, test_fgs_params_panda_zebra) yield from run_gridscan_and_move( - fake_fgs_composite, test_fgs_params_panda_zebra, feature_controlled + fgs_composite_with_panda_pcap, + test_fgs_params_panda_zebra, + feature_controlled, ) RE( @@ -443,20 +483,22 @@ async def test_when_gridscan_finished_then_smargon_stub_offsets_are_set_and_dev_ aperture_set: MagicMock, RE_with_subs: ReWithSubs, test_fgs_params_panda_zebra: ThreeDGridScan, - fake_fgs_composite: FlyScanXRayCentreComposite, + fgs_composite_with_panda_pcap: FlyScanXRayCentreComposite, ): feature_controlled = _get_feature_controlled( - fake_fgs_composite, test_fgs_params_panda_zebra + fgs_composite_with_panda_pcap, test_fgs_params_panda_zebra ) RE, (nexus_cb, ispyb_cb) = RE_with_subs test_fgs_params_panda_zebra.features.set_stub_offsets = True - fake_fgs_composite.eiger.odin.fan.dev_shm_enable.sim_put(1) # type: ignore + fgs_composite_with_panda_pcap.eiger.odin.fan.dev_shm_enable.sim_put(1) # type: ignore def wrapped_gridscan_and_move(): run_generic_ispyb_handler_setup(ispyb_cb, test_fgs_params_panda_zebra) yield from run_gridscan_and_move( - fake_fgs_composite, test_fgs_params_panda_zebra, feature_controlled + fgs_composite_with_panda_pcap, + test_fgs_params_panda_zebra, + feature_controlled, ) RE( @@ -465,10 +507,10 @@ def wrapped_gridscan_and_move(): ) ) assert ( - await fake_fgs_composite.smargon.stub_offsets.center_at_current_position.proc.get_value() + await fgs_composite_with_panda_pcap.smargon.stub_offsets.center_at_current_position.proc.get_value() == 1 ) - assert fake_fgs_composite.eiger.odin.fan.dev_shm_enable.get() == 0 + assert fgs_composite_with_panda_pcap.eiger.odin.fan.dev_shm_enable.get() == 0 @patch( "dodal.devices.aperturescatterguard.ApertureScatterguard.set", @@ -487,18 +529,20 @@ def test_when_gridscan_succeeds_ispyb_comment_appended_to( aperture_set: MagicMock, RE_with_subs: ReWithSubs, test_fgs_params_panda_zebra: ThreeDGridScan, - fake_fgs_composite: FlyScanXRayCentreComposite, + fgs_composite_with_panda_pcap: FlyScanXRayCentreComposite, ): RE, (nexus_cb, ispyb_cb) = RE_with_subs feature_controlled = _get_feature_controlled( - fake_fgs_composite, + fgs_composite_with_panda_pcap, test_fgs_params_panda_zebra, ) def _wrapped_gridscan_and_move(): run_generic_ispyb_handler_setup(ispyb_cb, test_fgs_params_panda_zebra) yield from run_gridscan_and_move( - fake_fgs_composite, test_fgs_params_panda_zebra, feature_controlled + fgs_composite_with_panda_pcap, + test_fgs_params_panda_zebra, + feature_controlled, ) RE.subscribe(VerbosePlanExecutionLoggingCallback()) @@ -578,21 +622,23 @@ def test_when_gridscan_fails_ispyb_comment_appended_to( run_gridscan: MagicMock, RE_with_subs: ReWithSubs, test_fgs_params_panda_zebra: ThreeDGridScan, - fake_fgs_composite: FlyScanXRayCentreComposite, + fgs_composite_with_panda_pcap: FlyScanXRayCentreComposite, ): RE, (nexus_cb, ispyb_cb) = RE_with_subs feature_controlled = _get_feature_controlled( - fake_fgs_composite, + fgs_composite_with_panda_pcap, test_fgs_params_panda_zebra, ) def wrapped_gridscan_and_move(): run_generic_ispyb_handler_setup(ispyb_cb, test_fgs_params_panda_zebra) yield from run_gridscan_and_move( - fake_fgs_composite, test_fgs_params_panda_zebra, feature_controlled + fgs_composite_with_panda_pcap, + test_fgs_params_panda_zebra, + feature_controlled, ) - mock_zocalo_trigger(fake_fgs_composite.zocalo, []) + mock_zocalo_trigger(fgs_composite_with_panda_pcap.zocalo, []) RE( ispyb_activation_wrapper( wrapped_gridscan_and_move(), test_fgs_params_panda_zebra @@ -623,15 +669,17 @@ def test_GIVEN_no_results_from_zocalo_WHEN_communicator_wait_for_results_called_ mock_complete: MagicMock, RE_with_subs: ReWithSubs, test_fgs_params_panda_zebra: ThreeDGridScan, - fake_fgs_composite: FlyScanXRayCentreComposite, + fgs_composite_with_panda_pcap: FlyScanXRayCentreComposite, done_status: Status, ): RE, (nexus_cb, ispyb_cb) = RE_with_subs feature_controlled = _get_feature_controlled( - fake_fgs_composite, + fgs_composite_with_panda_pcap, test_fgs_params_panda_zebra, ) - fake_fgs_composite.eiger.unstage = MagicMock(return_value=done_status) + fgs_composite_with_panda_pcap.eiger.unstage = MagicMock( + return_value=done_status + ) initial_x_y_z = np.array( [ random.uniform(-0.5, 0.5), @@ -639,17 +687,25 @@ def test_GIVEN_no_results_from_zocalo_WHEN_communicator_wait_for_results_called_ random.uniform(-0.5, 0.5), ] ) - set_mock_value(fake_fgs_composite.smargon.x.user_readback, initial_x_y_z[0]) - set_mock_value(fake_fgs_composite.smargon.y.user_readback, initial_x_y_z[1]) - set_mock_value(fake_fgs_composite.smargon.z.user_readback, initial_x_y_z[2]) + set_mock_value( + fgs_composite_with_panda_pcap.smargon.x.user_readback, initial_x_y_z[0] + ) + set_mock_value( + fgs_composite_with_panda_pcap.smargon.y.user_readback, initial_x_y_z[1] + ) + set_mock_value( + fgs_composite_with_panda_pcap.smargon.z.user_readback, initial_x_y_z[2] + ) def wrapped_gridscan_and_move(): run_generic_ispyb_handler_setup(ispyb_cb, test_fgs_params_panda_zebra) yield from run_gridscan_and_move( - fake_fgs_composite, test_fgs_params_panda_zebra, feature_controlled + fgs_composite_with_panda_pcap, + test_fgs_params_panda_zebra, + feature_controlled, ) - mock_zocalo_trigger(fake_fgs_composite.zocalo, []) + mock_zocalo_trigger(fgs_composite_with_panda_pcap.zocalo, []) RE( ispyb_activation_wrapper( wrapped_gridscan_and_move(), test_fgs_params_panda_zebra @@ -668,27 +724,29 @@ async def test_given_gridscan_fails_to_centre_then_stub_offsets_not_set( move_xyz: MagicMock, run_gridscan: MagicMock, RE: RunEngine, - fake_fgs_composite: FlyScanXRayCentreComposite, + fgs_composite_with_panda_pcap: FlyScanXRayCentreComposite, test_fgs_params_panda_zebra: ThreeDGridScan, ): class MoveException(Exception): pass feature_controlled = _get_feature_controlled( - fake_fgs_composite, + fgs_composite_with_panda_pcap, test_fgs_params_panda_zebra, ) - mock_zocalo_trigger(fake_fgs_composite.zocalo, []) + mock_zocalo_trigger(fgs_composite_with_panda_pcap.zocalo, []) move_xyz.side_effect = MoveException() with pytest.raises(MoveException): RE( run_gridscan_and_move( - fake_fgs_composite, test_fgs_params_panda_zebra, feature_controlled + fgs_composite_with_panda_pcap, + test_fgs_params_panda_zebra, + feature_controlled, ) ) assert ( - await fake_fgs_composite.smargon.stub_offsets.center_at_current_position.proc.get_value() + await fgs_composite_with_panda_pcap.smargon.stub_offsets.center_at_current_position.proc.get_value() == 0 ) @@ -702,17 +760,17 @@ async def test_given_setting_stub_offsets_disabled_then_stub_offsets_not_set( self, move_xyz: MagicMock, run_gridscan: MagicMock, - fake_fgs_composite: FlyScanXRayCentreComposite, + fgs_composite_with_panda_pcap: FlyScanXRayCentreComposite, test_fgs_params_panda_zebra: ThreeDGridScan, RE_with_subs: ReWithSubs, done_status: Status, ): RE, (nexus_cb, ispyb_cb) = RE_with_subs - fake_fgs_composite.aperture_scatterguard.set = MagicMock( + fgs_composite_with_panda_pcap.aperture_scatterguard.set = MagicMock( return_value=done_status ) feature_controlled = _get_feature_controlled( - fake_fgs_composite, + fgs_composite_with_panda_pcap, test_fgs_params_panda_zebra, ) test_fgs_params_panda_zebra.features.set_stub_offsets = False @@ -720,7 +778,9 @@ async def test_given_setting_stub_offsets_disabled_then_stub_offsets_not_set( def wrapped_gridscan_and_move(): run_generic_ispyb_handler_setup(ispyb_cb, test_fgs_params_panda_zebra) yield from run_gridscan_and_move( - fake_fgs_composite, test_fgs_params_panda_zebra, feature_controlled + fgs_composite_with_panda_pcap, + test_fgs_params_panda_zebra, + feature_controlled, ) RE.subscribe(VerbosePlanExecutionLoggingCallback()) @@ -731,7 +791,7 @@ def wrapped_gridscan_and_move(): ) ) assert ( - await fake_fgs_composite.smargon.stub_offsets.center_at_current_position.proc.get_value() + await fgs_composite_with_panda_pcap.smargon.stub_offsets.center_at_current_position.proc.get_value() == 0 ) @@ -833,6 +893,57 @@ def test_when_grid_scan_ran_then_eiger_disarmed_before_zocalo_end( mock_parent.assert_has_calls([call.disarm(), call.run_end(0), call.run_end(0)]) + @patch( + "hyperion.experiment_plans.flyscan_xray_centre_plan.set_and_create_panda_directory", + new=MagicMock(side_effect=_custom_msg("set_panda_directory")), + ) + @patch( + "hyperion.device_setup_plans.setup_panda.arm_panda_for_gridscan", + new=MagicMock(side_effect=_custom_msg("arm_panda")), + ) + @patch( + "hyperion.experiment_plans.flyscan_xray_centre_plan.disarm_panda_for_gridscan", + new=MagicMock(side_effect=_custom_msg("disarm_panda")), + ) + @patch( + "hyperion.experiment_plans.flyscan_xray_centre_plan.run_gridscan", + new=MagicMock(side_effect=_custom_msg("do_gridscan")), + ) + def test_flyscan_xray_centre_sets_directory_stages_arms_disarms_unstages_the_panda( + self, + done_status: Status, + fgs_composite_with_panda_pcap: FlyScanXRayCentreComposite, + fgs_params_use_panda: ThreeDGridScan, + sim_run_engine: RunEngineSimulator, + ): + sim_run_engine.add_handler("unstage", lambda _: done_status) + sim_run_engine.add_read_handler_for( + fgs_composite_with_panda_pcap.smargon.x.max_velocity, 10 + ) + + msgs = sim_run_engine.simulate_plan( + flyscan_xray_centre(fgs_composite_with_panda_pcap, fgs_params_use_panda) + ) + + msgs = assert_message_and_return_remaining( + msgs, lambda msg: msg.command == "set_panda_directory" + ) + msgs = assert_message_and_return_remaining( + msgs, lambda msg: msg.command == "stage" and msg.obj.name == "panda" + ) + msgs = assert_message_and_return_remaining( + msgs, lambda msg: msg.command == "arm_panda" + ) + msgs = assert_message_and_return_remaining( + msgs, lambda msg: msg.command == "do_gridscan" + ) + msgs = assert_message_and_return_remaining( + msgs, lambda msg: msg.command == "disarm_panda" + ) + msgs = assert_message_and_return_remaining( + msgs, lambda msg: msg.command == "unstage" and msg.obj.name == "panda" + ) + @patch("hyperion.experiment_plans.flyscan_xray_centre_plan.bps.wait", autospec=True) @patch( "hyperion.experiment_plans.flyscan_xray_centre_plan.bps.complete", autospec=True diff --git a/tests/unit_tests/hyperion/test_main_system.py b/tests/unit_tests/hyperion/test_main_system.py index 5baf303a0..00f23e01a 100644 --- a/tests/unit_tests/hyperion/test_main_system.py +++ b/tests/unit_tests/hyperion/test_main_system.py @@ -516,9 +516,9 @@ def test_log_on_invalid_json_params(test_env: ClientAndRunEngine): response = test_env.client.put(TEST_BAD_PARAM_ENDPOINT, data='{"bad":1}').json assert isinstance(response, dict) assert response.get("status") == Status.FAILED.value - assert ( - response.get("message") - == 'ValueError("Supplied parameters don\'t match the plan for this endpoint")' + assert (message := response.get("message")) is not None + assert message.startswith( + "ValueError('Supplied parameters don\\'t match the plan for this endpoint" ) assert response.get("exception_type") == "ValueError"