def test_timer_sleep(self): """Testing Timer: internal sleep""" with self.assertRaises(ValueError): x = Timer(0.1, lambda: None) x.fun = _stop(x) x.running = True x._run() x.stop() time.sleep = _fail Timer.wait(-1, seconds=0.1)
def test_timer_stop(self): """Testing Timer: stop""" x = Timer(0.2, lambda: None) x.run() x.stop() x.wait(2, 0) # increase to count green thread