Skip to content

Commit

Permalink
Changed from builder.aOut to builder.Action for commands
Browse files Browse the repository at this point in the history
`builder.Action` is a wrapper to a `boolOut` with `always_update=True`.
This is how PandaBlocks-ioc does it and will probably work with
ophyd-async.
  • Loading branch information
evalott100 committed Dec 6, 2024
1 parent baebfaa commit 5708b39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/fastcs/transport/epics/ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,8 @@ def _create_and_link_command_pv(
async def wrapped_method(_: Any):
await method()

record = builder.aOut(
record = builder.Action(
f"{pv_prefix}:{pv_name}",
initial_value=0,
always_update=True,
on_update=wrapped_method,
)

Expand Down
8 changes: 2 additions & 6 deletions tests/transport/epics/test_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ def test_ioc(mocker: MockerFixture, controller: Controller):
always_update=True,
on_update=mocker.ANY,
)
builder.aOut.assert_any_call(
f"{DEVICE}:Go", initial_value=0, always_update=True, on_update=mocker.ANY
)
builder.Action.assert_any_call(f"{DEVICE}:Go", on_update=mocker.ANY)

# Check info tags are added
add_pvi_info.assert_called_once_with(f"{DEVICE}:PVI")
Expand Down Expand Up @@ -443,10 +441,8 @@ def test_long_pv_names_discarded(mocker: MockerFixture):
assert not getattr(long_name_controller, long_command_name).fastcs_method.enabled

short_command_pv_name = "command_short_name".title().replace("_", "")
builder.aOut.assert_called_once_with(
builder.Action.assert_called_once_with(
f"{DEVICE}:{short_command_pv_name}",
initial_value=0,
always_update=True,
on_update=mocker.ANY,
)
with pytest.raises(AssertionError):
Expand Down

0 comments on commit 5708b39

Please sign in to comment.