Fix #13449: add 'blocking' parameter to sched.scheduler.run() so that the scheduler can be used in non-blocking applications
diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py
index f5e159d..ae82f94 100644
--- a/Lib/test/test_sched.py
+++ b/Lib/test/test_sched.py
@@ -86,6 +86,16 @@
scheduler.run()
self.assertEqual(flag, [None])
+ def test_run_non_blocking(self):
+ l = []
+ fun = lambda x: l.append(x)
+ scheduler = sched.scheduler(time.time, time.sleep)
+ for x in [10, 9, 8, 7, 6]:
+ scheduler.enter(x, 1, fun, (x,))
+ scheduler.run(blocking=False)
+ self.assertEqual(l, [])
+
+
def test_main():
support.run_unittest(TestCase)