From c19d57c89075e36b0fb2ec6f007ea802972c5a38 Mon Sep 17 00:00:00 2001 From: Sanniti Pimpley Date: Thu, 4 Oct 2018 10:31:01 -0400 Subject: [PATCH] test(api): fix test errors (#2417) --- api/opentrons/hardware_control/controller.py | 2 +- .../module_drivers/test_temp_deck_driver.py | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/api/opentrons/hardware_control/controller.py b/api/opentrons/hardware_control/controller.py index 2556f1b8a16..a3ed19304d9 100644 --- a/api/opentrons/hardware_control/controller.py +++ b/api/opentrons/hardware_control/controller.py @@ -4,7 +4,7 @@ from typing import Dict from opentrons.util import environment from opentrons.drivers.smoothie_drivers import driver_3_0 -from opentrons.robot import robot_configs +from opentrons.legacy_api.robot import robot_configs _lock = threading.Lock() diff --git a/api/tests/opentrons/drivers/module_drivers/test_temp_deck_driver.py b/api/tests/opentrons/drivers/module_drivers/test_temp_deck_driver.py index 2620998ca23..65e453fd2b2 100644 --- a/api/tests/opentrons/drivers/module_drivers/test_temp_deck_driver.py +++ b/api/tests/opentrons/drivers/module_drivers/test_temp_deck_driver.py @@ -45,30 +45,26 @@ def _mock_send_command(self, command, timeout=None): def test_fail_get_temp_deck_temperature(): # Get the curent and target temperatures - # If no target temp has been previously set, - # then the response will set 'T' to 'none' + # If get fails, temp_deck temperature is not updated import types from opentrons.drivers.temp_deck import TempDeck temp_deck = TempDeck() temp_deck.simulating = False - return_string = 'T:none C:90' - def _mock_send_command(self, command, timeout=None): - return return_string + def _mock_send_command1(self, command, timeout=None): + return 'T:none C:90' - temp_deck._send_command = types.MethodType(_mock_send_command, temp_deck) + temp_deck._send_command = types.MethodType(_mock_send_command1, temp_deck) temp_deck.update_temperature() assert temp_deck._temperature == {'current': 90, 'target': None} - return_string = 'Tx:none C:1' + def _mock_send_command2(self, command, timeout=None): + return 'Tx:none C:1' # Failure premise - def _mock_send_command(self, command, timeout=None): - return return_string - - temp_deck._send_command = types.MethodType(_mock_send_command, temp_deck) + temp_deck._send_command = types.MethodType(_mock_send_command2, temp_deck) temp_deck.update_temperature() assert temp_deck._temperature == {'current': 90, 'target': None}