Skip to content

Commit

Permalink
chore(api): fix tests after #17285
Browse files Browse the repository at this point in the history
That PR changed the stop behavior on OT-2 to fix some bugs but the tests
didn't get changed. Fix the tests.
  • Loading branch information
sfoster1 committed Jan 21, 2025
1 parent 9c70751 commit 9e81c29
Showing 1 changed file with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test hardware stopping execution and side effects."""

from __future__ import annotations

import pytest
Expand Down Expand Up @@ -78,12 +79,12 @@ async def test_hardware_halt(


@pytest.mark.parametrize(
argnames=["post_run_hardware_state", "expected_home_after"],
argvalues=[
(PostRunHardwareState.STAY_ENGAGED_IN_PLACE, False),
(PostRunHardwareState.DISENGAGE_IN_PLACE, False),
(PostRunHardwareState.HOME_AND_STAY_ENGAGED, True),
(PostRunHardwareState.HOME_THEN_DISENGAGE, True),
"post_run_hardware_state",
[
PostRunHardwareState.STAY_ENGAGED_IN_PLACE,
PostRunHardwareState.DISENGAGE_IN_PLACE,
PostRunHardwareState.HOME_AND_STAY_ENGAGED,
PostRunHardwareState.HOME_THEN_DISENGAGE,
],
)
async def test_hardware_stopping_sequence(
Expand All @@ -94,7 +95,6 @@ async def test_hardware_stopping_sequence(
mock_tip_handler: TipHandler,
subject: HardwareStopper,
post_run_hardware_state: PostRunHardwareState,
expected_home_after: bool,
) -> None:
"""It should stop the hardware, and home the robot. Flex no longer performs automatic drop tip.."""
decoy.when(state_store.pipettes.get_all_attached_tips()).then_return(
Expand All @@ -113,7 +113,7 @@ async def test_hardware_stopping_sequence(
await movement.home(
axes=[MotorAxis.X, MotorAxis.Y, MotorAxis.LEFT_Z, MotorAxis.RIGHT_Z]
),
await hardware_api.stop(home_after=expected_home_after),
await hardware_api.stop(home_after=False),
)


Expand All @@ -122,6 +122,7 @@ async def test_hardware_stopping_sequence_without_pipette_tips(
hardware_api: HardwareAPI,
state_store: StateStore,
subject: HardwareStopper,
movement: MovementHandler,
) -> None:
"""Don't drop tip when there aren't any tips attached to pipettes."""
decoy.when(state_store.pipettes.get_all_attached_tips()).then_return([])
Expand All @@ -132,7 +133,10 @@ async def test_hardware_stopping_sequence_without_pipette_tips(
)

decoy.verify(
await hardware_api.stop(home_after=True),
await hardware_api.stop(home_after=False),
await movement.home(
[MotorAxis.X, MotorAxis.Y, MotorAxis.LEFT_Z, MotorAxis.RIGHT_Z]
),
)


Expand Down Expand Up @@ -171,6 +175,7 @@ async def test_hardware_stopping_sequence_no_pipette(
state_store: StateStore,
hardware_api: HardwareAPI,
mock_tip_handler: TipHandler,
movement: MovementHandler,
subject: HardwareStopper,
) -> None:
"""It should gracefully no-op if the HW API reports no attached pipette."""
Expand All @@ -193,8 +198,14 @@ async def test_hardware_stopping_sequence_no_pipette(
)

decoy.verify(
await hardware_api.stop(home_after=True),
times=1,
await hardware_api.stop(home_after=False),
await movement.home(
[MotorAxis.X, MotorAxis.Y, MotorAxis.LEFT_Z, MotorAxis.RIGHT_Z]
),
await hardware_api.stop(home_after=False),
await movement.home(
[MotorAxis.X, MotorAxis.Y, MotorAxis.LEFT_Z, MotorAxis.RIGHT_Z]
),
)


Expand Down Expand Up @@ -336,5 +347,8 @@ async def test_hardware_stopping_sequence_with_OT2_addressable_area(
pipette_id="pipette-id",
home_after=False,
),
await hardware_api.stop(home_after=True),
await hardware_api.stop(home_after=False),
await movement.home(
axes=[MotorAxis.X, MotorAxis.Y, MotorAxis.LEFT_Z, MotorAxis.RIGHT_Z]
),
)

0 comments on commit 9e81c29

Please sign in to comment.