Skip to content

Commit

Permalink
fix flaky test in test_bart_robot.py (#947)
Browse files Browse the repository at this point in the history
#943 Fix flakey bart robot unit test
  • Loading branch information
arikaran-13 authored Dec 10, 2024
1 parent 4b224c1 commit 665b949
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/devices/unit_tests/test_bart_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,17 @@ async def test_given_program_not_running_and_pin_unmounting_but_new_pin_not_moun

async def test_given_program_not_running_and_pin_unmounts_then_mounts_when_load_pin_then_pin_loaded():
device = await _get_bart_robot()
device.LOAD_TIMEOUT = 0.03 # type: ignore
device.LOAD_TIMEOUT = 0.05 # type: ignore
set_mock_value(device.program_running, False)
set_mock_value(device.gonio_pin_sensor, PinMounted.PIN_MOUNTED)

device.load = AsyncMock(side_effect=device.load)
status = device.set(SampleLocation(15, 10))
await sleep(0.01)
await sleep(0.025)
device.load.trigger.assert_called_once() # type:ignore

set_mock_value(device.gonio_pin_sensor, PinMounted.NO_PIN_MOUNTED)
await sleep(0.005)
await sleep(0.025)

set_mock_value(device.gonio_pin_sensor, PinMounted.PIN_MOUNTED)
await status
assert status.success
Expand Down

0 comments on commit 665b949

Please sign in to comment.