Show More
@@ -15,9 +15,6 b'' | |||||
15 | # Stdlib imports |
|
15 | # Stdlib imports | |
16 | import time |
|
16 | import time | |
17 |
|
17 | |||
18 | # Third-party imports |
|
|||
19 | import nose.tools as nt |
|
|||
20 |
|
||||
21 | # Our own imports |
|
18 | # Our own imports | |
22 | from IPython.lib import backgroundjobs as bg |
|
19 | from IPython.lib import backgroundjobs as bg | |
23 |
|
20 | |||
@@ -49,18 +46,18 b' def test_result():' | |||||
49 | jobs = bg.BackgroundJobManager() |
|
46 | jobs = bg.BackgroundJobManager() | |
50 | j = jobs.new(sleeper) |
|
47 | j = jobs.new(sleeper) | |
51 | j.join() |
|
48 | j.join() | |
52 |
|
|
49 | assert j.result["interval"] == t_short | |
53 |
|
50 | |||
54 |
|
51 | |||
55 | def test_flush(): |
|
52 | def test_flush(): | |
56 | """Test job control""" |
|
53 | """Test job control""" | |
57 | jobs = bg.BackgroundJobManager() |
|
54 | jobs = bg.BackgroundJobManager() | |
58 | j = jobs.new(sleeper) |
|
55 | j = jobs.new(sleeper) | |
59 | j.join() |
|
56 | j.join() | |
60 |
|
|
57 | assert len(jobs.completed) == 1 | |
61 |
|
|
58 | assert len(jobs.dead) == 0 | |
62 | jobs.flush() |
|
59 | jobs.flush() | |
63 |
|
|
60 | assert len(jobs.completed) == 0 | |
64 |
|
61 | |||
65 |
|
62 | |||
66 | def test_dead(): |
|
63 | def test_dead(): | |
@@ -68,10 +65,10 b' def test_dead():' | |||||
68 | jobs = bg.BackgroundJobManager() |
|
65 | jobs = bg.BackgroundJobManager() | |
69 | j = jobs.new(crasher) |
|
66 | j = jobs.new(crasher) | |
70 | j.join() |
|
67 | j.join() | |
71 |
|
|
68 | assert len(jobs.completed) == 0 | |
72 |
|
|
69 | assert len(jobs.dead) == 1 | |
73 | jobs.flush() |
|
70 | jobs.flush() | |
74 |
|
|
71 | assert len(jobs.dead) == 0 | |
75 |
|
72 | |||
76 |
|
73 | |||
77 | def test_longer(): |
|
74 | def test_longer(): | |
@@ -81,8 +78,8 b' def test_longer():' | |||||
81 | # job as running, but not so long that it makes the test suite noticeably |
|
78 | # job as running, but not so long that it makes the test suite noticeably | |
82 | # slower. |
|
79 | # slower. | |
83 | j = jobs.new(sleeper, 0.1) |
|
80 | j = jobs.new(sleeper, 0.1) | |
84 |
|
|
81 | assert len(jobs.running) == 1 | |
85 |
|
|
82 | assert len(jobs.completed) == 0 | |
86 | j.join() |
|
83 | j.join() | |
87 |
|
|
84 | assert len(jobs.running) == 0 | |
88 |
|
|
85 | assert len(jobs.completed) == 1 |
General Comments 0
You need to be logged in to leave comments.
Login now