Skip to content

Commit

Permalink
Update test mocks to differentiate ot2/ot3 hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
fsinapi committed Dec 5, 2023
1 parent ede3171 commit 34cc782
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions robot-server/tests/instruments/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
GripperModel,
)
from opentrons_shared_data.pipette.dev_types import PipetteName, PipetteModel
from opentrons_shared_data.robot.dev_types import RobotTypeEnum

from robot_server.instruments.instrument_models import (
Gripper,
Expand All @@ -50,7 +51,9 @@
@pytest.fixture
def ot2_hardware_api(decoy: Decoy) -> HardwareControlAPI:
"""Get a mock hardware control API."""
return decoy.mock(cls=API)
mock = decoy.mock(cls=API)
decoy.when(mock.get_robot_type()).then_return(RobotTypeEnum.OT2)
return mock


def get_sample_pipette_dict(
Expand All @@ -77,7 +80,9 @@ def ot3_hardware_api(decoy: Decoy) -> HardwareControlAPI:
try:
from opentrons.hardware_control.ot3api import OT3API

return decoy.mock(cls=OT3API)
mock = decoy.mock(cls=OT3API)
decoy.when(mock.get_robot_type()).then_return(RobotTypeEnum.FLEX)
return mock
except ImportError:
return None # type: ignore[return-value]

Expand Down

0 comments on commit 34cc782

Please sign in to comment.