Check the stopped timer once stop returns, not after a wait
This commit is contained in:
@@ -152,8 +152,9 @@ class Timer(unittest.TestCase):
|
||||
|
||||
def test_a_timer_stopped_before_its_delay_has_passed_never_runs_the_action(self):
|
||||
ran = threading.Event()
|
||||
# stop returns once the timer's thread has ended, so the action cannot run later.
|
||||
start_timer(0.2, ran.set)()
|
||||
self.assertFalse(ran.wait(0.5))
|
||||
self.assertFalse(ran.is_set())
|
||||
|
||||
def test_stopping_a_timer_whose_action_runs_waits_for_the_action_to_end(self):
|
||||
started, ended = threading.Event(), threading.Event()
|
||||
|
||||
Reference in New Issue
Block a user