Skip to content

Commit 858219e

Browse files
authored
fix(robot-server): remove pip offset after tlc in fused flow (#7020)
1 parent 243c683 commit 858219e

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

robot-server/robot_server/robot/calibration/pipette_offset/user_flow.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Any, Awaitable, Callable, Dict,
44
List, Optional, Union, TYPE_CHECKING, Tuple)
55

6-
from opentrons.calibration_storage import get, modify, helpers
6+
from opentrons.calibration_storage import get, modify, helpers, delete
77
from opentrons.calibration_storage.types import (
88
TipLengthCalNotFound, PipetteOffsetByPipetteMount)
99
from opentrons.config import feature_flags as ff
@@ -409,10 +409,13 @@ async def save_offset(self):
409409
# set critical point explicitly to nozzle
410410
noz_pt = await self.get_current_point(
411411
critical_point=CriticalPoint.NOZZLE)
412+
412413
util.save_tip_length_calibration(
413414
pipette_id=self._hw_pipette.pipette_id,
414415
tip_length_offset=noz_pt.z - self._nozzle_height_at_reference,
415416
tip_rack=self._tip_rack)
417+
delete.delete_pipette_offset_file(
418+
self._hw_pipette.pipette_id, self.mount)
416419
new_tip_length = self._get_stored_tip_length_cal()
417420
self._has_calibrated_tip_length = new_tip_length is not None
418421
# load the new tip length for the rest of the session

robot-server/tests/robot/calibration/pipette_offset/test_user_flow.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ async def gantry_pos_mock(*args, **kwargs):
112112
hardware.gantry_position = MagicMock(side_effect=gantry_pos_mock)
113113
hardware.move_to = MagicMock(side_effect=async_mock_move_to)
114114
hardware.get_instrument_max_height.return_value = 180
115+
hardware.retract = MagicMock(side_effect=async_mock)
115116
return hardware
116117

117118

@@ -149,6 +150,7 @@ async def gantry_pos_mock(*args, **kwargs):
149150
hardware.get_instrument_max_height.return_value = 180
150151
hardware.home_plunger = MagicMock(side_effect=async_mock)
151152
hardware.home = MagicMock(side_effect=async_mock)
153+
hardware.retract = MagicMock(side_effect=async_mock)
152154

153155
return hardware
154156

@@ -411,11 +413,46 @@ def test_no_pipette(hardware, mount):
411413

412414
@pytest.fixture
413415
def mock_save_pipette():
414-
with patch('opentrons.calibration_storage.modify.save_pipette_calibration',
416+
with patch(
417+
'opentrons.calibration_storage.modify.save_pipette_calibration',
418+
autospec=True) as mock_save:
419+
yield mock_save
420+
421+
422+
@pytest.fixture
423+
def mock_delete_pipette():
424+
with patch(
425+
'opentrons.calibration_storage.delete.delete_pipette_offset_file',
426+
autospec=True) as mock_delete:
427+
yield mock_delete
428+
429+
430+
@pytest.fixture
431+
def mock_save_tip_length():
432+
with patch('robot_server.robot.calibration.util.save_tip_length_calibration', # noqa(E501)
415433
autospec=True) as mock_save:
416434
yield mock_save
417435

418436

437+
async def test_save_tip_length(
438+
mock_user_flow_fused, mock_save_tip_length, mock_delete_pipette):
439+
uf = mock_user_flow_fused
440+
uf._current_state = uf._state.measuringTipOffset
441+
uf._nozzle_height_at_reference = 10
442+
uf._hw_pipette.add_tip(50)
443+
await uf._hardware.move_to(mount=uf._mount,
444+
abs_poition=Point(x=10, y=10, z=40),
445+
critical_point=uf.critical_point_override)
446+
await uf.save_offset()
447+
mock_save_tip_length.assert_called_with(
448+
pipette_id=uf._hw_pipette.pipette_id,
449+
tip_length_offset=-10,
450+
tip_rack=uf._tip_rack
451+
)
452+
mock_delete_pipette.assert_called_with(
453+
uf._hw_pipette.pipette_id, uf.mount)
454+
455+
419456
async def test_save_pipette_calibration(mock_user_flow, mock_save_pipette):
420457
uf = mock_user_flow
421458

0 commit comments

Comments
 (0)