Skip to content

Commit

Permalink
fix some of the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Nov 22, 2024
1 parent 6836113 commit 8495bc0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion api/src/opentrons/protocol_api/core/engine/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,8 @@ def _pressure_supported_by_pipette(self) -> bool:
supported = self._sync_hardware_api.get_pressure_sensor_available(
mount=self.get_mount()
)
assert isinstance(supported, bool)
if not isinstance(supported, bool):
return False
return supported

def detect_liquid_presence(self, well_core: WellCore, loc: Location) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/protocol_api/instrument_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,13 +1702,13 @@ def liquid_presence_detection(self) -> bool:
When ``True``, the pipette will check for liquid on every aspiration.
Defaults to ``False``. See :ref:`lpd`.
"""
self._raise_if_pressure_not_supported_by_pipette()
return self._core.get_liquid_presence_detection()

@liquid_presence_detection.setter
@requires_version(2, 20)
def liquid_presence_detection(self, enable: bool) -> None:
self._raise_if_pressure_not_supported_by_pipette()
if enable:
self._raise_if_pressure_not_supported_by_pipette()
self._core.set_liquid_presence_detection(enable)

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ async def test_liquid_probe(
mock_move_group_run.side_effect = probe_move_group_run_side_effect(
head_node, tool_node
)
controller._pipettes_to_monitor_pressure = mock.MagicMock(return_value=[sensor_node_for_mount(mount)])
try:
await controller.liquid_probe(
mount=mount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def mock_instrument_core(decoy: Decoy) -> InstrumentCore:
"""Get a mock instrument implementation core."""
instrument_core = decoy.mock(cls=InstrumentCore)
decoy.when(instrument_core.get_mount()).then_return(Mount.LEFT)

decoy.when(instrument_core._pressure_supported_by_pipette()).then_return(True)
# we need to add this for the mock of liquid_presence detection to actually work
# this replaces the mock with a a property again
instrument_core._liquid_presence_detection = False # type: ignore[attr-defined]
Expand Down

0 comments on commit 8495bc0

Please sign in to comment.