diff options
author | Giampaolo Rodola' <g.rodola@gmail.com> | 2011-12-14 13:38:45 (GMT) |
---|---|---|
committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2011-12-14 13:38:45 (GMT) |
commit | 556ba04a8d07bf9d0996410ecda809d337f51885 (patch) | |
tree | 92c16f0dfc492ed425a1fbaf2cb4655db6748645 /Lib/test/test_sched.py | |
parent | 73520d57ebfb1272d009a070191e749caebf64ae (diff) | |
download | cpython-556ba04a8d07bf9d0996410ecda809d337f51885.zip cpython-556ba04a8d07bf9d0996410ecda809d337f51885.tar.gz cpython-556ba04a8d07bf9d0996410ecda809d337f51885.tar.bz2 |
Fix #13449: add 'blocking' parameter to sched.scheduler.run() so that the scheduler can be used in non-blocking applications
Diffstat (limited to 'Lib/test/test_sched.py')
-rw-r--r-- | Lib/test/test_sched.py | 10 |
1 files changed, 10 insertions, 0 deletions
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 @@ class TestCase(unittest.TestCase): 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) |