Skip to content

Commit

Permalink
Merge pull request ipython#5463 from minrk/spin-slow
Browse files Browse the repository at this point in the history
make spin_thread tests more forgiving of slow VMs
  • Loading branch information
takluyver committed Mar 28, 2014
2 parents dff74f3 + b9bb277 commit 409e8e7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions IPython/parallel/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,19 +522,23 @@ def test_purge_everything(self):
def test_spin_thread(self):
self.client.spin_thread(0.01)
ar = self.client[-1].apply_async(lambda : 1)
time.sleep(0.1)
self.assertTrue(ar.wall_time < 0.1,
"spin should have kept wall_time < 0.1, but got %f" % ar.wall_time
)
md = self.client.metadata[ar.msg_ids[0]]
# 3s timeout, 100ms poll
for i in range(30):
time.sleep(0.1)
if md['received'] is not None:
break
self.assertIsInstance(md['received'], datetime)

def test_stop_spin_thread(self):
self.client.spin_thread(0.01)
self.client.stop_spin_thread()
ar = self.client[-1].apply_async(lambda : 1)
time.sleep(0.15)
self.assertTrue(ar.wall_time > 0.1,
"Shouldn't be spinning, but got wall_time=%f" % ar.wall_time
)
md = self.client.metadata[ar.msg_ids[0]]
# 500ms timeout, 100ms poll
for i in range(5):
time.sleep(0.1)
self.assertIsNone(md['received'], None)

def test_activate(self):
ip = get_ipython()
Expand Down

0 comments on commit 409e8e7

Please sign in to comment.