Test control of longer-running jobs
()
| 75 | |
| 76 | |
| 77 | def test_longer(): |
| 78 | """Test control of longer-running jobs""" |
| 79 | jobs = bg.BackgroundJobManager() |
| 80 | # Sleep for long enough for the following two checks to still report the |
| 81 | # job as running, but not so long that it makes the test suite noticeably |
| 82 | # slower. |
| 83 | j = jobs.new(sleeper, 0.1) |
| 84 | nt.assert_equal(len(jobs.running), 1) |
| 85 | nt.assert_equal(len(jobs.completed), 0) |
| 86 | j.join() |
| 87 | nt.assert_equal(len(jobs.running), 0) |
| 88 | nt.assert_equal(len(jobs.completed), 1) |