Skip to content

Commit c3caad3

Browse files
authored
fix(api): flex stacker store command should check labware configuration before hopper labware count (#18176)
1 parent 3329159 commit c3caad3

File tree

2 files changed

+19
-8
lines changed
  • api
    • src/opentrons/protocol_engine/commands/flex_stacker
    • tests/opentrons/protocol_engine/commands/flex_stacker

2 files changed

+19
-8
lines changed

api/src/opentrons/protocol_engine/commands/flex_stacker/store.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,14 @@ async def execute(self, params: StoreParams) -> _ExecuteReturn:
177177
stacker_state = self._state_view.modules.get_flex_stacker_substate(
178178
params.moduleId
179179
)
180+
180181
location = self._state_view.modules.get_location(params.moduleId)
182+
pool_definitions = stacker_state.get_pool_definition_ordered_list()
183+
if pool_definitions is None:
184+
raise FlexStackerLabwarePoolNotYetDefinedError(
185+
message=f"The Flex Stacker in {location} has not been configured yet and cannot be filled."
186+
)
187+
181188
if (
182189
len(stacker_state.contained_labware_bottom_first)
183190
== stacker_state.max_pool_count
@@ -186,12 +193,6 @@ async def execute(self, params: StoreParams) -> _ExecuteReturn:
186193
f"Cannot store labware in Flex Stacker in {location} because it is full"
187194
)
188195

189-
pool_definitions = stacker_state.get_pool_definition_ordered_list()
190-
if pool_definitions is None:
191-
raise FlexStackerLabwarePoolNotYetDefinedError(
192-
message=f"The Flex Stacker in {location} has not been configured yet and cannot be filled."
193-
)
194-
195196
primary_id, maybe_adapter_id, maybe_lid_id = self._verify_labware_to_store(
196197
params, stacker_state
197198
)

api/tests/opentrons/protocol_engine/commands/flex_stacker/test_store.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,17 @@ async def test_store_raises_if_carriage_logically_empty(
137137
await subject.execute(data)
138138

139139

140+
@pytest.mark.parametrize(
141+
"contained_labware_count,max_pool_count",
142+
[
143+
(0, 0),
144+
(1, 0),
145+
(0, 1),
146+
],
147+
)
140148
async def test_store_raises_if_not_configured(
149+
contained_labware_count: int,
150+
max_pool_count: int,
141151
decoy: Decoy,
142152
equipment: EquipmentHandler,
143153
state_view: StateView,
@@ -151,8 +161,8 @@ async def test_store_raises_if_not_configured(
151161
pool_primary_definition=None,
152162
pool_adapter_definition=None,
153163
pool_lid_definition=None,
154-
contained_labware_bottom_first=_contained_labware(1),
155-
max_pool_count=0,
164+
contained_labware_bottom_first=_contained_labware(contained_labware_count),
165+
max_pool_count=max_pool_count,
156166
pool_overlap=0,
157167
)
158168
decoy.when(

0 commit comments

Comments
 (0)