def test_stop(self, join): context = Mock() child = Mock() # test m = Monitor(context, child) m.stop() # validation self.assertEqual(m.poll, False) join.assert_called_once_with()
def test_run(self, sleep): context = Mock() context.cancelled.side_effect = [False, True] child = Mock() # test m = Monitor(context, child) m.run() # validation child.terminate.assert_called_once_with() sleep.assert_called_once_with(0.10)