Update tests #59
@@ -28,7 +28,7 @@ class NIDAQWriterService(BECService):
|
||||
def __init__(self, config: ServiceConfig, connector_cls: RedisConnector) -> None:
|
||||
super().__init__(config=config, connector_cls=connector_cls, unique_service=True)
|
||||
self.queue = queue.Queue()
|
||||
config = self._service_config.service_config.get("file_writer")
|
||||
config = self._service_config.config.get("file_writer")
|
||||
self.writer_mixin = FileWriter(service_config=config)
|
||||
self._scan_status_consumer = None
|
||||
self._ni_data_consumer = None
|
||||
|
||||
@@ -74,15 +74,16 @@ def test_egu(mock_bragg):
|
||||
def test_move_succeeds(mock_bragg):
|
||||
dev = mock_bragg
|
||||
dev.move_abs._read_pv.mock_data = 0
|
||||
# Move succeeds
|
||||
with mock.patch.object(dev.motor_is_moving._read_pv, "mock_data", side_effect=[0, 1]):
|
||||
status = dev.move(0.5)
|
||||
# Sleep needed to allow thread to resolive in _move_and_finish, i.e. and the 0.25s sleep inside the function
|
||||
time.sleep(1)
|
||||
assert status.done is True
|
||||
assert status.success is True
|
||||
assert dev.setpoint.get() == 0.5
|
||||
assert dev.move_abs.get() == 1
|
||||
dev.motor_is_moving._read_pv.mock_data = 0
|
||||
|
||||
status = dev.move(0.5)
|
||||
assert status.done is False
|
||||
dev.motor_is_moving._read_pv.mock_data = 1
|
||||
status.wait(timeout=3) # Callback should within that time
|
||||
assert status.done is True
|
||||
assert status.success is True
|
||||
assert dev.setpoint.get() == 0.5
|
||||
assert dev.move_abs.get() == 1
|
||||
|
||||
|
||||
def test_stop_move(mock_bragg):
|
||||
|
||||
Reference in New Issue
Block a user