From 13220557b1d18be36c111824d2847adf56f25c7f Mon Sep 17 00:00:00 2001 From: Andy Sigler Date: Mon, 18 Jun 2018 14:36:12 -0400 Subject: [PATCH] fix(api): Fixes bug in replacing substring of old p50 pipettes written with v13 instead of v1.3 (#1717) --- .../drivers/smoothie_drivers/driver_3_0.py | 2 +- api/tests/opentrons/drivers/test_driver.py | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/api/opentrons/drivers/smoothie_drivers/driver_3_0.py b/api/opentrons/drivers/smoothie_drivers/driver_3_0.py index 4a1a4d0b6b8..1eac606c38b 100755 --- a/api/opentrons/drivers/smoothie_drivers/driver_3_0.py +++ b/api/opentrons/drivers/smoothie_drivers/driver_3_0.py @@ -383,7 +383,7 @@ def read_pipette_model(self, mount): # Backward compatibility for pipettes programmed with model # strings that did not include the "." to seperate version # major and minor values - res = res.replace('_v13', 'v1.3') + res = res.replace('_v13', '_v1.3') return res diff --git a/api/tests/opentrons/drivers/test_driver.py b/api/tests/opentrons/drivers/test_driver.py index 956d577a4cf..cf079803719 100755 --- a/api/tests/opentrons/drivers/test_driver.py +++ b/api/tests/opentrons/drivers/test_driver.py @@ -481,6 +481,26 @@ def _new_send_message(self, command, timeout=None): driver._send_command = types.MethodType(_old_send_command, driver) +def test_read_pipette_v13(model): + import types + from opentrons.drivers.smoothie_drivers.driver_3_0 import \ + _byte_array_to_hex_string + + driver = model.robot._driver + _old_send_command = driver._send_command + driver.simulating = False + + def _new_send_message(self, command, timeout=None): + return 'L:' + _byte_array_to_hex_string(b'p300_single_v13') + + driver._send_command = types.MethodType(_new_send_message, driver) + + res = driver.read_pipette_model('left') + assert res == 'p300_single_v1.3' + + driver._send_command = types.MethodType(_old_send_command, driver) + + def test_fast_home(model): import types driver = model.robot._driver