From 8743a9efd764c38d204462b17083697e2c29b43f Mon Sep 17 00:00:00 2001 From: Peter Wegmann <85115389+Bilchreis@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:25:42 +0200 Subject: [PATCH] trigger readable dev test --- tests/test_Node.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/test_Node.py b/tests/test_Node.py index 8dd08d8..ba8ccbf 100644 --- a/tests/test_Node.py +++ b/tests/test_Node.py @@ -2,7 +2,7 @@ import numpy as np import xprocess -from ophyd_async.core import SignalR, observe_value +from ophyd_async.core import AsyncStatus, SignalR, observe_value from xprocess import ProcessStarter, XProcessInfo from secop_ophyd.SECoPDevices import SECoPMoveableDevice, SECoPNodeDevice @@ -106,6 +106,32 @@ async def test_status(cryo_sim, cryo_node_internal_loop: SECoPNodeDevice): await cryo_node_internal_loop.disconnect_async() +async def test_trigger(cryo_sim, cryo_node_internal_loop: SECoPNodeDevice): + # Node device has no read value, it has to return an empty dict + cryo_dev: SECoPMoveableDevice = cryo_node_internal_loop.cryo + + val_old = await cryo_dev.read() + + val_cached = await cryo_dev.read() + + assert ( + val_old[cryo_dev.value.name]["value"] + == val_cached[cryo_dev.value.name]["value"] + ) + + stat: AsyncStatus = cryo_dev.trigger() + + await stat + + val_new = await cryo_dev.read() + + assert ( + val_old[cryo_dev.value.name]["value"] != val_new[cryo_dev.value.name]["value"] + ) + + await cryo_node_internal_loop.disconnect_async() + + # async def test_node_read_config(cryo_sim,cryo_node:SECoP_Node_Device): # # Node device has no read value, it has to return an empty dict # val_desc = await cryo_node.read_configuration()