def test_old_probe_height(short_trash_flag): from opentrons.robot import robot_configs cfg = robot_configs.load() assert cfg.probe_center[2] == 55.0 assert cfg.probe_dimensions[2] == 60.0
def __init__(self, config=None): """ Initializes a robot instance. Notes ----- This class is a singleton. That means every time you call :func:`__init__` the same instance will be returned. There's only once instance of a robot. """ self.config = config or load() self._driver = driver_3_0.SmoothieDriver_3_0_0(config=self.config) self.modules = [] self.fw_version = self._driver.get_fw_version() self.INSTRUMENT_DRIVERS_CACHE = {} self.model_by_mount = {'left': None, 'right': None} # TODO (artyom, 09182017): once protocol development experience # in the light of Session concept is fully fleshed out, we need # to properly communicate deprecation of commands. For now we'll # leave it as is for compatibility with documentation. self._commands = [] self._unsubscribe_commands = None self.reset()
def mock_config(): from opentrons.robot import robot_configs test_config = robot_configs.load() test_config = test_config._replace(name='new-value1') robot_configs.save_robot_settings(test_config) return robot_configs
def save_config() -> str: try: robot_configs.save_robot_settings(robot.config) robot_configs.save_deck_calibration(robot.config) result = robot_configs.load() except Exception as e: result = repr(e) return result
def test_load_corrupt_json(): import os from opentrons.robot import robot_configs filename = os.path.join(os.path.dirname(__file__), 'bad_config.json') with open(filename, 'w') as file: file.write('') # empty config file c = robot_configs.load(filename) assert c.version == 2 os.remove(filename)
def test_save_and_clear_config(mock_config): # Clear should happen automatically after the following import, resetting # the robot config to the default value from robot_configs from opentrons.deck_calibration import dc_main from opentrons import robot import os old_config = robot.config base_filename = get_config_index().get('deckCalibrationFile') tag = "testing" root, ext = os.path.splitext(base_filename) filename = "{}-{}{}".format(root, tag, ext) dc_main.backup_configuration_and_reload(tag=tag) from opentrons import robot from opentrons.robot import robot_configs assert robot.config == robot_configs._build_config({}, {}) saved_config = robot_configs.load(filename) assert saved_config == old_config
def test_default_probe_height(): from opentrons.robot import robot_configs cfg = robot_configs.load() assert cfg.probe_center[2] == 77.0 assert cfg.probe_dimensions[2] == 82.0
def clear_configuration_and_reload(): robot_configs.clear() robot.config = robot_configs.load() robot.reset()