bec-ipython-client 3.35.6__py3-none-any.whl → 3.84.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of bec-ipython-client might be problematic. Click here for more details.

@@ -108,12 +108,10 @@ def test_config_updates(bec_client_lib):
108
108
  assert dev.rt_controller.limits == [-50, 50]
109
109
 
110
110
  dev.rt_controller.velocity.set(10).wait()
111
+ assert dev.rt_controller.velocity.read(cached=True)["rt_controller_velocity"]["value"] == 10
111
112
  assert dev.rt_controller.velocity.read()["rt_controller_velocity"]["value"] == 10
112
- assert dev.rt_controller.velocity.read(cached=False)["rt_controller_velocity"]["value"] == 10
113
113
  assert dev.rt_controller.read_configuration()["rt_controller_velocity"]["value"] == 10
114
- assert (
115
- dev.rt_controller.read_configuration(cached=False)["rt_controller_velocity"]["value"] == 10
116
- )
114
+ assert dev.rt_controller.read_configuration()["rt_controller_velocity"]["value"] == 10
117
115
 
118
116
  dev.rt_controller.velocity.put(5)
119
117
  assert dev.rt_controller.velocity.get() == 5
@@ -183,7 +181,7 @@ def test_dap_fit(bec_client_lib):
183
181
  "hexapod": {
184
182
  "deviceClass": "ophyd_devices.SynDeviceOPAAS",
185
183
  "deviceConfig": {},
186
- "deviceTags": ["user motors"],
184
+ "deviceTags": {"user motors"},
187
185
  "readoutPriority": "baseline",
188
186
  "enabled": True,
189
187
  "readOnly": False,
@@ -196,7 +194,7 @@ def test_dap_fit(bec_client_lib):
196
194
  "tolerance": 0.01,
197
195
  "update_frequency": 400,
198
196
  },
199
- "deviceTags": ["user motors"],
197
+ "deviceTags": {"user motors"},
200
198
  "enabled": True,
201
199
  "readOnly": False,
202
200
  },
@@ -210,7 +208,7 @@ def test_dap_fit(bec_client_lib):
210
208
  "hexapod": {
211
209
  "deviceClass": "ophyd_devices.SynDeviceOPAAS",
212
210
  "deviceConfig": {},
213
- "deviceTags": ["user motors"],
211
+ "deviceTags": {"user motors"},
214
212
  "readoutPriority": "baseline",
215
213
  "enabled": True,
216
214
  "readOnly": False,
@@ -224,7 +222,7 @@ def test_dap_fit(bec_client_lib):
224
222
  "update_frequency": 400,
225
223
  },
226
224
  "readoutPriority": "baseline",
227
- "deviceTags": ["user motors"],
225
+ "deviceTags": {"user motors"},
228
226
  "enabled": True,
229
227
  "readOnly": False,
230
228
  },
@@ -238,7 +236,7 @@ def test_dap_fit(bec_client_lib):
238
236
  "hexapod": {
239
237
  "deviceClass": "ophyd_devices.SynDeviceOPAAS",
240
238
  "deviceConfig": {},
241
- "deviceTags": ["user motors"],
239
+ "deviceTags": {"user motors"},
242
240
  "readoutPriority": "baseline",
243
241
  "enabled": True,
244
242
  "readOnly": False,
@@ -247,7 +245,7 @@ def test_dap_fit(bec_client_lib):
247
245
  "deviceClass": "ophyd_devices.utils.bec_utils.DeviceClassConnectionError",
248
246
  "deviceConfig": {},
249
247
  "readoutPriority": "baseline",
250
- "deviceTags": ["user motors"],
248
+ "deviceTags": {"user motors"},
251
249
  "enabled": True,
252
250
  "readOnly": False,
253
251
  },
@@ -261,7 +259,7 @@ def test_dap_fit(bec_client_lib):
261
259
  "hexapod": {
262
260
  "deviceClass": "SynDeviceOPAAS",
263
261
  "deviceConfig": {},
264
- "deviceTags": ["user motors"],
262
+ "deviceTags": {"user motors"},
265
263
  "readoutPriority": "baseline",
266
264
  "enabled": True,
267
265
  "readOnly": False,
@@ -270,7 +268,7 @@ def test_dap_fit(bec_client_lib):
270
268
  "deviceClass": "ophyd_devices.utils.bec_utils.DeviceClassInitError",
271
269
  "deviceConfig": {},
272
270
  "readoutPriority": "baseline",
273
- "deviceTags": ["user motors"],
271
+ "deviceTags": {"user motors"},
274
272
  "enabled": True,
275
273
  "readOnly": False,
276
274
  },
@@ -284,7 +282,7 @@ def test_dap_fit(bec_client_lib):
284
282
  "hexapod": {
285
283
  "deviceClass": "SynDeviceOPAAS",
286
284
  "deviceConfig": {},
287
- "deviceTags": ["user motors"],
285
+ "deviceTags": {"user motors"},
288
286
  "readoutPriority": "baseline",
289
287
  "enabled": True,
290
288
  "readOnly": False,
@@ -293,7 +291,7 @@ def test_dap_fit(bec_client_lib):
293
291
  "deviceClass": "ophyd_devices.WrongDeviceClass",
294
292
  "deviceConfig": {},
295
293
  "readoutPriority": "baseline",
296
- "deviceTags": ["user motors"],
294
+ "deviceTags": {"user motors"},
297
295
  "enabled": True,
298
296
  "readOnly": False,
299
297
  },
@@ -324,7 +322,9 @@ def test_config_reload(
324
322
  num_devices = len(bec.device_manager.devices)
325
323
  if raises_error:
326
324
  with pytest.raises(DeviceConfigError):
327
- bec.config.update_session_with_file(runtime_config_file_path)
325
+ bec.config.update_session_with_file(
326
+ runtime_config_file_path, force=True, validate=False
327
+ )
328
328
  if deletes_config:
329
329
  assert len(bec.device_manager.devices) == 0
330
330
  elif disabled_device:
@@ -332,7 +332,7 @@ def test_config_reload(
332
332
  else:
333
333
  assert len(bec.device_manager.devices) == num_devices
334
334
  else:
335
- bec.config.update_session_with_file(runtime_config_file_path)
335
+ bec.config.update_session_with_file(runtime_config_file_path, force=True, validate=False)
336
336
  assert len(bec.device_manager.devices) == 2
337
337
  for dev in disabled_device:
338
338
  assert bec.device_manager.devices[dev].enabled is False
@@ -347,7 +347,7 @@ def test_config_reload_with_describe_failure(bec_test_config_file_path, bec_clie
347
347
  "hexapod": {
348
348
  "deviceClass": "ophyd_devices.sim.sim_test_devices.SimPositionerWithDescribeFailure",
349
349
  "deviceConfig": {},
350
- "deviceTags": ["user motors"],
350
+ "deviceTags": {"user motors"},
351
351
  "readoutPriority": "baseline",
352
352
  "enabled": True,
353
353
  "readOnly": False,
@@ -361,7 +361,7 @@ def test_config_reload_with_describe_failure(bec_test_config_file_path, bec_clie
361
361
  "update_frequency": 400,
362
362
  },
363
363
  "readoutPriority": "baseline",
364
- "deviceTags": ["user motors"],
364
+ "deviceTags": {"user motors"},
365
365
  "enabled": True,
366
366
  "readOnly": False,
367
367
  },
@@ -377,7 +377,7 @@ def test_config_reload_with_describe_failure(bec_test_config_file_path, bec_clie
377
377
  f.write(yaml.dump(config))
378
378
 
379
379
  with pytest.raises(DeviceConfigError):
380
- bec.config.update_session_with_file(runtime_config_file_path)
380
+ bec.config.update_session_with_file(runtime_config_file_path, force=True, validate=False)
381
381
 
382
382
  assert len(bec.device_manager.devices) == 2
383
383
  assert bec.device_manager.devices["eyefoc"].enabled is True
@@ -388,7 +388,7 @@ def test_config_reload_with_describe_failure(bec_test_config_file_path, bec_clie
388
388
  f"e2e_test_hexapod_fail", messages.DeviceStatusMessage(device="hexapod", status=0)
389
389
  )
390
390
 
391
- bec.config.update_session_with_file(runtime_config_file_path)
391
+ bec.config.update_session_with_file(runtime_config_file_path, force=True)
392
392
  assert len(bec.device_manager.devices) == 2
393
393
  assert bec.device_manager.devices["eyefoc"].enabled is True
394
394
  assert bec.device_manager.devices["hexapod"].enabled is True
@@ -409,18 +409,18 @@ def test_config_add_remove_device(bec_client_lib):
409
409
  "update_frequency": 400,
410
410
  },
411
411
  "readoutPriority": "baseline",
412
- "deviceTags": ["user motors"],
412
+ "deviceTags": {"user motors"},
413
413
  "enabled": True,
414
414
  "readOnly": False,
415
415
  }
416
416
  }
417
- bec.config.send_config_request(action="add", config=config)
417
+ bec.device_manager.config_helper.send_config_request(action="add", config=config)
418
418
  with pytest.raises(DeviceConfigError) as config_error:
419
- bec.config.send_config_request(action="add", config=config)
419
+ bec.device_manager.config_helper.send_config_request(action="add", config=config)
420
420
  assert config_error.match("Device new_device already exists")
421
421
  assert "new_device" in dev
422
422
 
423
- bec.config.send_config_request(action="remove", config={"new_device": {}})
423
+ bec.device_manager.config_helper.send_config_request(action="remove", config={"new_device": {}})
424
424
  assert "new_device" not in dev
425
425
 
426
426
  device_config_msg = bec.connector.get(MessageEndpoints.device_config())
@@ -431,7 +431,7 @@ def test_config_add_remove_device(bec_client_lib):
431
431
 
432
432
  config["new_device"]["deviceClass"] = "ophyd_devices.doesnt_exist"
433
433
  with pytest.raises(DeviceConfigError) as config_error:
434
- bec.config.send_config_request(action="add", config=config)
434
+ bec.device_manager.config_helper.send_config_request(action="add", config=config)
435
435
  assert config_error.match("module 'ophyd_devices' has no attribute 'doesnt_exist'")
436
436
  assert "new_device" not in dev
437
437
  assert "samx" in dev
@@ -454,7 +454,7 @@ def test_computed_signal(bec_client_lib):
454
454
  dev.pseudo_signal1.set_compute_method(compute_signal1)
455
455
  dev.pseudo_signal1.set_input_signals()
456
456
 
457
- assert dev.pseudo_signal1.read(cached=False)["pseudo_signal1"]["value"] == 5
457
+ assert dev.pseudo_signal1.read()["pseudo_signal1"]["value"] == 5
458
458
 
459
459
 
460
460
  def test_cached_device_readout(bec_client_lib):
@@ -463,26 +463,30 @@ def test_cached_device_readout(bec_client_lib):
463
463
  dev = bec.device_manager.devices
464
464
 
465
465
  dev.samx.setpoint.put(5)
466
- data = dev.samx.setpoint.get()
466
+ data = dev.samx.setpoint.get(cached=True)
467
467
  assert data == 5
468
468
 
469
- orig_velocity = dev.samx.velocity.get()
469
+ orig_velocity = dev.samx.velocity.get(cached=True)
470
470
  dev.samx.velocity.put(10)
471
- data = dev.samx.velocity.get()
471
+ data = dev.samx.velocity.get(cached=True)
472
472
  assert data == 10
473
473
 
474
- config = dev.samx.read_configuration()
474
+ config = dev.samx.read_configuration(cached=True)
475
475
  assert config["samx_velocity"]["value"] == 10
476
476
 
477
+ dev.samx.velocity.set(20).wait()
478
+ data = dev.samx.velocity.get(cached=True)
479
+ assert data == 20
480
+
477
481
  dev.samx.velocity.put(orig_velocity)
478
482
 
479
- data = dev.hexapod.x.readback.read(cached=False)
483
+ data = dev.hexapod.x.readback.read()
480
484
  timestamp = data["hexapod_x"]["timestamp"]
481
485
  data = dev.hexapod.x.readback.read(cached=True)
482
486
  assert data["hexapod_x"]["timestamp"] == timestamp
483
487
 
484
488
  # check that .get also updates the cache
485
- dev.hexapod.x.readback.get(cached=False)
489
+ dev.hexapod.x.readback.get()
486
490
  timestamp_2 = dev.hexapod.x.readback.read(cached=True)["hexapod_x"]["timestamp"]
487
491
  assert timestamp_2 != timestamp
488
492