Skip to content

Commit

Permalink
fix(api): add case correction to module_context.load_labware (#14964)
Browse files Browse the repository at this point in the history
Closes RESC-235 and RQA-2610

# Overview

Fixes the `module_context.load_labware()` method by ensuring that
labware names are converted into lower case before using them in any
part of the code.

The escalations issue above was caused by a cascade of things happening
because the protocol had a module labware loaded with the labware name
written in mixed case. There are a few places where we do string
comparison of the labware names, including when trying to find new
versions of a labware and when looking up LPC offsets for a labware.
These string comparisons would fail because all labware definitions have
lowercase names, and hence would lead to unexpected behavior. It should
no longer create such a problem

# Risk assessment

Very low. Tiny bug fix
  • Loading branch information
sanni-t committed Apr 19, 2024
1 parent b5a9115 commit 165956d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions api/src/opentrons/protocol_api/module_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def load_labware(
load_location = loaded_adapter._core
else:
load_location = self._core

name = validation.ensure_lowercase_name(name)
labware_core = self._protocol_core.load_labware(
load_name=name,
label=label,
Expand Down Expand Up @@ -467,9 +467,9 @@ def engage(
if height is not None:
if self._api_version >= _MAGNETIC_MODULE_HEIGHT_PARAM_REMOVED_IN:
raise APIVersionError(
"The height parameter of MagneticModuleContext.engage() was removed"
" in {_MAGNETIC_MODULE_HEIGHT_PARAM_REMOVED_IN}."
" Use offset or height_from_base instead."
f"The height parameter of MagneticModuleContext.engage() was removed"
f" in {_MAGNETIC_MODULE_HEIGHT_PARAM_REMOVED_IN}."
f" Use offset or height_from_base instead."
)
self._core.engage(height_from_home=height)

Expand Down
2 changes: 1 addition & 1 deletion api/tests/opentrons/protocol_api/test_module_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_load_labware(
decoy.when(mock_labware_core.get_well_columns()).then_return([])

result = subject.load_labware(
name="infinite tip rack",
name="Infinite Tip Rack",
label="it doesn't run out",
namespace="ideal",
version=101,
Expand Down

0 comments on commit 165956d

Please sign in to comment.