From 7e283a8ad40e78c8ae8f2f51d36187cfbdb8d079 Mon Sep 17 00:00:00 2001 From: appel_c Date: Wed, 7 Jan 2026 11:12:35 +0100 Subject: [PATCH] test(falcon): fix test for improved patched_device method in ophyd_devices --- tests/tests_devices/test_falcon_csaxs.py | 46 ++++++++++++------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/tests/tests_devices/test_falcon_csaxs.py b/tests/tests_devices/test_falcon_csaxs.py index 058e7ae..fb1e100 100644 --- a/tests/tests_devices/test_falcon_csaxs.py +++ b/tests/tests_devices/test_falcon_csaxs.py @@ -32,7 +32,7 @@ def mock_det() -> Generator[FalconcSAXS, None, None]: name="falcon", prefix="X12SA-SITORO:", device_manager=dm, - _mock_pv_initial_value=0, + _mock_pv_initial_value=1, ) as dev: try: for dotted_name, device in dev.walk_subdevices(include_lazy=True): @@ -110,30 +110,28 @@ def test_falcon_on_stage(mock_det: FalconcSAXS): falcon.hdf5.array_counter.put(5) # Set to non-zero to check reset # I. Normal case - old_file_event = falcon.file_event.get() - with mock.patch.object(falcon.hdf5.array_size, "get", return_value=(1, 1, 1)): + falcon.stage() + + assert falcon.staged is ophyd.Staged.yes + assert falcon._full_path == get_full_path(falcon.scan_info.msg, falcon.name) + file_path = falcon.hdf5.file_path.get() + file_name = falcon.hdf5.file_name.get() + assert os.path.join(file_path, file_name) == falcon._full_path + + assert falcon.preset_real_time.get() == exp_time + assert falcon.pixels_per_run.get() == num_points * frames_per_trigger + assert falcon.hdf5.num_capture.get() == num_points * frames_per_trigger + assert falcon.hdf5.array_counter.get() == 0 + assert falcon.hdf5.capture.get() == 1 + assert falcon.start_all.get() == 1 + + # II. Unstage device first + falcon.unstage() + exp_time = 1e-3 # Smaller than readout time + falcon.scan_info.msg.scan_parameters["exp_time"] = exp_time + with pytest.raises(ValueError): falcon.stage() - - assert falcon.staged is ophyd.Staged.yes - assert falcon._full_path == get_full_path(falcon.scan_info.msg, falcon.name) - file_path = falcon.hdf5.file_path.get() - file_name = falcon.hdf5.file_name.get() - assert os.path.join(file_path, file_name) == falcon._full_path - - assert falcon.preset_real_time.get() == exp_time - assert falcon.pixels_per_run.get() == num_points * frames_per_trigger - assert falcon.hdf5.num_capture.get() == num_points * frames_per_trigger - assert falcon.hdf5.array_counter.get() == 0 - assert falcon.hdf5.capture.get() == 1 - assert falcon.start_all.get() == 1 - - # II. Unstage device first - falcon.unstage() - exp_time = 1e-3 # Smaller than readout time - falcon.scan_info.msg.scan_parameters["exp_time"] = exp_time - with pytest.raises(ValueError): - falcon.stage() - assert falcon.staged is not ophyd.Staged.no + assert falcon.staged is not ophyd.Staged.no def test_falcon_on_pre_scan(mock_det: FalconcSAXS):