Skip to content

Commit cfac9a1

Browse files
committed
Fix for threading tests for Timer class
1 parent 7895315 commit cfac9a1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_threading.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,11 @@ def test_init_immutable_default_args(self):
10851085

10861086
def test_continuous_execution(self):
10871087
timer = threading.Timer(0.01, self._callback_cont)
1088-
self.callback_event.wait(0.1)
1088+
self.callback_event.clear()
1089+
timer.start()
1090+
for i in range(3):
1091+
self.callback_event.wait(1)
1092+
self.callback_event.clear()
10891093
self.assertEqual(self.callback_cnt, 0)
10901094

10911095
def _callback_spy(self, *args, **kwargs):
@@ -1094,6 +1098,7 @@ def _callback_spy(self, *args, **kwargs):
10941098

10951099
def _callback_cont(self):
10961100
self.callback_cnt -= 1
1101+
self.callback_event.set()
10971102
return self.callback_cnt > 0
10981103

10991104
class LockTests(lock_tests.LockTests):

0 commit comments

Comments
 (0)