Skip to content

Commit

Permalink
fix api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed May 7, 2024
1 parent 1135ad9 commit e2996a9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
7 changes: 6 additions & 1 deletion api/src/opentrons/hardware_control/backends/ot3controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,12 @@ async def liquid_probe(
for node, point in positions.items():
self._position.update({node: point.motor_position})
self._encoder_position.update({node: point.encoder_position})
if positions[head_node].move_ack == MoveCompleteAck.complete_without_condition:
print(f"positions {positions}")
if (
head_node not in positions
or positions[head_node].move_ack
== MoveCompleteAck.complete_without_condition
):
raise LiquidNotFound(
{
node_to_axis(node): point.motor_position
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
EstopState,
CurrentConfig,
InstrumentProbeType,
LiquidNotFound,
)
from opentrons.hardware_control.errors import (
InvalidPipetteName,
Expand Down Expand Up @@ -715,14 +716,19 @@ async def test_liquid_probe(
mock_move_group_run: mock.AsyncMock,
mock_send_stop_threshold: mock.AsyncMock,
) -> None:
await controller.liquid_probe(
mount=mount,
max_z_distance=fake_liquid_settings.max_z_distance,
mount_speed=fake_liquid_settings.mount_speed,
plunger_speed=fake_liquid_settings.plunger_speed,
threshold_pascals=fake_liquid_settings.sensor_threshold_pascals,
output_option=fake_liquid_settings.output_option,
)
try:
await controller.liquid_probe(
mount=mount,
max_z_distance=fake_liquid_settings.max_z_distance,
mount_speed=fake_liquid_settings.mount_speed,
plunger_speed=fake_liquid_settings.plunger_speed,
threshold_pascals=fake_liquid_settings.sensor_threshold_pascals,
output_option=fake_liquid_settings.output_option,
)
except LiquidNotFound:
# the move raises a liquid not found now since we don't call the move group and it doesn't
# get any positions back
pass
move_groups = (mock_move_group_run.call_args_list[0][0][0]._move_groups)[0][0]
head_node = axis_to_node(Axis.by_mount(mount))
tool_node = sensor_node_for_mount(mount)
Expand Down

0 comments on commit e2996a9

Please sign in to comment.