From 73349257ee0228a9563051d4f8e0bf5f7e6b551f Mon Sep 17 00:00:00 2001 From: appel_c Date: Mon, 3 Jun 2024 09:16:40 +0200 Subject: [PATCH] refactor: add .wait() to set methods --- ophyd_devices/sim/sim_monitor_async.py | 4 ++-- tests/test_simulation.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ophyd_devices/sim/sim_monitor_async.py b/ophyd_devices/sim/sim_monitor_async.py index b176e7a..467c66a 100644 --- a/ophyd_devices/sim/sim_monitor_async.py +++ b/ophyd_devices/sim/sim_monitor_async.py @@ -35,7 +35,7 @@ class SimMonitorAsyncPrepare(CustomDetectorMixin): def prep_random_interval(self): """Prepare counter and random interval to send data to BEC.""" self._random_send_interval = np.random.randint(1, 10) - self.parent.current_trigger.set(0) + self.parent.current_trigger.set(0).wait() self._counter = self.parent.current_trigger.get() def on_stage(self): @@ -74,7 +74,7 @@ class SimMonitorAsyncPrepare(CustomDetectorMixin): self.parent.data_buffer["value"].append(self.parent.readback.get()) self.parent.data_buffer["value"].append(self.parent.readback.timestamp) self._counter += 1 - self.parent.current_trigger.set(self._counter) + self.parent.current_trigger.set(self._counter).wait() if self._counter % self._random_send_interval == 0: self._send_data_to_bec() diff --git a/tests/test_simulation.py b/tests/test_simulation.py index f6c3589..dc995af 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -399,7 +399,7 @@ def test_async_monitor_complete(async_monitor): def test_async_mon_on_trigger(async_monitor): """Test the on_trigger method of SimMonitorAsync.""" with (mock.patch.object(async_monitor.custom_prepare, "_send_data_to_bec") as mock_send,): - async_monitor.stage() + async_monitor.custom_prepare.on_stage() upper_limit = async_monitor.custom_prepare._random_send_interval for ii in range(1, upper_limit + 1): async_monitor.custom_prepare.on_trigger()