def test_start(self): MockProcess.alive = False s = OFASupervisor(target=target_one, args=[2, 4, 8], kwargs={}, max_restart_freq=0, max_restart_freq_time=0) s.Process = MockProcess self.assertRaises(MaxRestartsExceededError, s.start) MockProcess.alive = True
def test__is_alive(self): s = OFASupervisor(target=target_one, args=[2, 4, 8], kwargs={}) s.Process = MockProcess proc = MockProcess(target_one, [2, 4, 8], {}) proc.start() self.assertTrue(s._is_alive(proc)) proc.alive = False self.assertFalse(s._is_alive(proc))
def test_init(self): s = OFASupervisor(target=target_one, args=[2, 4, 8], kwargs={}) s.Process = MockProcess