def test_stop(self): timer = RepeatingTimer(self._run_by_timer, 10) timer.start() assert timer.is_alive(), "timer is not running" timer.cancel() timer.join(1) assert not timer.is_alive(), "timer is still alive"
def test_init(self): timer = RepeatingTimer(self._run_by_timer, 0.5) timer.start() assert self._event.wait(1), "timer was not running" self._event.clear() assert self._event.wait(1), "timer was not running" timer.cancel()
def test_stop(self): timer = RepeatingTimer(self._run_by_timer, 10) timer.start() self.assertTrue(timer.isAlive(), 'timer is not running') timer.cancel() timer.join(1) self.assertFalse(timer.isAlive(), 'timer is still alive')
def test_init(self): timer = RepeatingTimer(self._run_by_timer, 0.5) timer.start() self.assertTrue(self._event.wait(1), 'timer was not running') self._event.clear() self.assertTrue(self._event.wait(1), 'timer was not running') timer.cancel()