fix(test-mo1-bragg): fix test for mo1_bragg mov succeeds.
This commit is contained in:
@@ -74,15 +74,16 @@ def test_egu(mock_bragg):
|
|||||||
def test_move_succeeds(mock_bragg):
|
def test_move_succeeds(mock_bragg):
|
||||||
dev = mock_bragg
|
dev = mock_bragg
|
||||||
dev.move_abs._read_pv.mock_data = 0
|
dev.move_abs._read_pv.mock_data = 0
|
||||||
# Move succeeds
|
dev.motor_is_moving._read_pv.mock_data = 0
|
||||||
with mock.patch.object(dev.motor_is_moving._read_pv, "mock_data", side_effect=[0, 1]):
|
|
||||||
status = dev.move(0.5)
|
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
|
assert status.done is False
|
||||||
time.sleep(1)
|
dev.motor_is_moving._read_pv.mock_data = 1
|
||||||
assert status.done is True
|
status.wait(timeout=3) # Callback should within that time
|
||||||
assert status.success is True
|
assert status.done is True
|
||||||
assert dev.setpoint.get() == 0.5
|
assert status.success is True
|
||||||
assert dev.move_abs.get() == 1
|
assert dev.setpoint.get() == 0.5
|
||||||
|
assert dev.move_abs.get() == 1
|
||||||
|
|
||||||
|
|
||||||
def test_stop_move(mock_bragg):
|
def test_stop_move(mock_bragg):
|
||||||
|
|||||||
Reference in New Issue
Block a user