Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
logger = logging.getLogger(__name__)


def _version_is_at_least(version: str, minimum: str) -> bool:
"""Compare versions that contain dot-separated integers."""
return tuple(int(component) for component in version.split(".")) >= tuple(
int(component) for component in minimum.split(".")
)


class _IOLogger:
"""Transparent proxy over the ``ot_api`` module that logs every call at
``LOG_LEVEL_IO``.
Expand Down Expand Up @@ -378,7 +385,7 @@ async def drop_tips(self, ops: List[Drop], use_channels: List[int]):
op = ops[0]

use_fixed_trash = (
cast(str, self.ot_api_version) >= _OT_DECK_IS_ADDRESSABLE_AREA_VERSION
_version_is_at_least(cast(str, self.ot_api_version), _OT_DECK_IS_ADDRESSABLE_AREA_VERSION)
and op.resource.name == "trash"
)
if use_fixed_trash:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pylabrobot.legacy.liquid_handling import LiquidHandler
from pylabrobot.legacy.liquid_handling.backends.opentrons_backend import (
_OT_DECK_IS_ADDRESSABLE_AREA_VERSION,
_version_is_at_least,
OpentronsOT2Backend,
)
from pylabrobot.legacy.liquid_handling.errors import NoChannelError
Expand Down Expand Up @@ -36,6 +37,14 @@ def _mock_health_get():
}


@pytest.mark.parametrize(
("version", "expected"),
(("7.0.1", False), ("7.1.0", True), ("26.6.0", True)),
)
def test_version_is_at_least(version: str, expected: bool) -> None:
assert _version_is_at_least(version, _OT_DECK_IS_ADDRESSABLE_AREA_VERSION) is expected


class OpentronsBackendSetupTests(unittest.IsolatedAsyncioTestCase):
"""Tests for setup and stop"""

Expand Down Expand Up @@ -233,7 +242,7 @@ async def test_tip_drop_to_trash_uses_addressable_area(
area (move_to_addressable_area_for_drop_tip + drop_tip_in_place), not drop_tip."""
mock_define.side_effect = _mock_define
mock_add.side_effect = _mock_add
self.backend.ot_api_version = _OT_DECK_IS_ADDRESSABLE_AREA_VERSION
self.backend.ot_api_version = "26.6.0"

await self.lh.pick_up_tips(self.tip_rack["A1"])
await self.lh.discard_tips()
Expand Down
Loading