'Tests the linux nanny.'

def testLinuxNanny(self):

    self.nanny_stubber.Stop()
    self.exit_called = False
    def MockExit(value):
        self.exit_called = value
        raise RuntimeError('Nannythread    exiting.')
    with utils.Stubber(os, '_exit', MockExit):
        nanny_controller = client_utils_linux.NannyController()
        nanny_controller.StartNanny(unresponsive_kill_period=0.5)
        for _ in range(10):
            time.sleep(0.1)
            nanny_controller.Heartbeat()
        self.assertEqual(self.exit_called, False)
        time.sleep(1)
        self.assertEqual(self.exit_called, (-1))
        nanny_controller.StopNanny()
