def test_picklability(c, s, a, b): q = Queue() def f(x): q.put(x + 1) yield c.submit(f, 10) result = yield q._get() assert result == 11
def test_same_futures(c, s, a, b): q = Queue('x') future = yield c._scatter(123) for i in range(5): yield q._put(future) assert s.wants_what['queue-x'] == {future.key} for i in range(4): future2 = yield q._get() assert s.wants_what['queue-x'] == {future.key} yield gen.sleep(0.05) assert s.wants_what['queue-x'] == {future.key} yield q._get() start = time() while s.wants_what['queue-x']: yield gen.sleep(0.01) assert time() - start < 2