@@ -112,6 +112,7 @@ async def gantry_pos_mock(*args, **kwargs):
112
112
hardware .gantry_position = MagicMock (side_effect = gantry_pos_mock )
113
113
hardware .move_to = MagicMock (side_effect = async_mock_move_to )
114
114
hardware .get_instrument_max_height .return_value = 180
115
+ hardware .retract = MagicMock (side_effect = async_mock )
115
116
return hardware
116
117
117
118
@@ -149,6 +150,7 @@ async def gantry_pos_mock(*args, **kwargs):
149
150
hardware .get_instrument_max_height .return_value = 180
150
151
hardware .home_plunger = MagicMock (side_effect = async_mock )
151
152
hardware .home = MagicMock (side_effect = async_mock )
153
+ hardware .retract = MagicMock (side_effect = async_mock )
152
154
153
155
return hardware
154
156
@@ -411,11 +413,46 @@ def test_no_pipette(hardware, mount):
411
413
412
414
@pytest .fixture
413
415
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)
415
433
autospec = True ) as mock_save :
416
434
yield mock_save
417
435
418
436
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
+
419
456
async def test_save_pipette_calibration (mock_user_flow , mock_save_pipette ):
420
457
uf = mock_user_flow
421
458
0 commit comments