test(falcon): fix test for improved patched_device method in ophyd_devices
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user