From 54218fd245b474f1dd9adc91cb9e81a6d15f02cf Mon Sep 17 00:00:00 2001 From: andySigler Date: Mon, 28 Nov 2016 13:11:37 -0500 Subject: [PATCH] adds robot.comment for printing custom messages during protocol run --- opentrons/robot/robot.py | 10 ++++++++++ tests/opentrons/protocol/test_robot.py | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/opentrons/robot/robot.py b/opentrons/robot/robot.py index f12c6ba0d74..d8c57d715fe 100644 --- a/opentrons/robot/robot.py +++ b/opentrons/robot/robot.py @@ -478,6 +478,16 @@ def _do(): log.info('Executing: Home now') return _do() + def comment(self, description): + def _do(): + pass + + def _setup(): + pass + + c = Command(do=_do, setup=_setup, description=description) + self.add_command(c) + def add_command(self, command): if command.description: diff --git a/tests/opentrons/protocol/test_robot.py b/tests/opentrons/protocol/test_robot.py index e28a20ce978..4a7c4716c17 100644 --- a/tests/opentrons/protocol/test_robot.py +++ b/tests/opentrons/protocol/test_robot.py @@ -32,6 +32,12 @@ def test_add_container(self): } self.assertEquals(res, expected) + def test_comment(self): + self.robot.clear_commands() + self.robot.comment('hello') + self.assertEquals(len(self.robot.commands()), 1) + self.assertEquals(self.robot._commands[0].description, 'hello') + def test_home_after_disconnect(self): self.robot.disconnect() self.assertRaises(RuntimeError, self.robot.home)