Skip to content

Commit

Permalink
Add notify option to Process.on_changed
Browse files Browse the repository at this point in the history
  • Loading branch information
c-mita committed Jun 28, 2016
1 parent c67fdf1 commit 061ae69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions malcolm/core/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,6 @@ def block_respond(self, response, response_queue):
def notify_subscribers(self, block_name):
self.q.put(BlockNotify(name=block_name))

def on_changed(self, change):
self.q.put(BlockChanged(change=change))
def on_changed(self, change, notify=True):
if notify:
self.q.put(BlockChanged(change=change))
3 changes: 2 additions & 1 deletion tests/test_controllers/test_countercontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def test_put_changes_value(self):
c.counter.parent = c.block
c.counter.put(32)
self.assertEqual(c.counter.value, 32)
c.block.on_changed.assert_called_once_with([["counter", "value"], 32])
c.block.on_changed.assert_called_once_with(
[["counter", "value"], 32], True)


if __name__ == "__main__":
Expand Down

0 comments on commit 061ae69

Please sign in to comment.