Skip to content

Commit

Permalink
(#117) (#45) update tests to use new sim signal helper
Browse files Browse the repository at this point in the history
  • Loading branch information
dperl-dls committed May 1, 2024
1 parent 730ee2c commit 0fc2ccb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/core/test_watchable_async_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from bluesky.protocols import Movable

from ophyd_async.core.async_status import AsyncStatus, WatchableAsyncStatus
from ophyd_async.core.signal import SignalR, SimSignalBackend
from ophyd_async.core.signal import soft_signal_r_and_backend
from ophyd_async.core.standard_readable import StandardReadable
from ophyd_async.core.utils import WatcherUpdate

Expand Down Expand Up @@ -66,7 +66,7 @@ def __call__(
class ASTestDevice(StandardReadable, Movable):
def __init__(self, name: str = "") -> None:
self._staged: bool = False
self.sig = SignalR(backend=SimSignalBackend(datatype=int))
self.sig, self._sig_backend = soft_signal_r_and_backend(datatype=int)
super().__init__(name)

@AsyncStatus.wrap
Expand All @@ -80,15 +80,15 @@ class ASTestDeviceSingleSet(ASTestDevice):
async def set(self, val):
assert self._staged
await asyncio.sleep(0.01)
self.sig._backend._set_value(val) # type: ignore
self._sig_backend._set_value(val) # type: ignore


class ASTestDeviceTimeoutSet(ASTestDevice):
@WatchableAsyncStatus.wrap
async def set(self, val, timeout=0.01):
assert self._staged
await asyncio.sleep(0.01)
self.sig._backend._set_value(val - 1) # type: ignore
self._sig_backend._set_value(val - 1) # type: ignore
await asyncio.sleep(0.01)
yield WatcherUpdate(1, 1, 1)
await asyncio.sleep(0.01)
Expand Down Expand Up @@ -121,7 +121,7 @@ async def set(self, val) -> AsyncIterator:
fraction=0,
)
if self.complete_set:
self.sig._backend._set_value(val) # type: ignore
self._sig_backend._set_value(val) # type: ignore
yield WatcherUpdate(
name=self.name,
current=val,
Expand Down

0 comments on commit 0fc2ccb

Please sign in to comment.