Skip to content

Commit

Permalink
Merge pull request #125 from OpenTrons/288-s-add-robot-comment
Browse files Browse the repository at this point in the history
adds robot.comment for printing custom messages during protocol run
  • Loading branch information
andySigler authored Nov 28, 2016
2 parents 0e09a39 + 54218fd commit 55d0379
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions opentrons/robot/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions tests/opentrons/protocol/test_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 55d0379

Please sign in to comment.