def test_multiple_maxlen(c, s, a, b): c2 = Client((s.ip, s.port), start=False) yield c2._start() x = c.channel('x', maxlen=10) assert x.data.maxlen == 10 x2 = c2.channel('x', maxlen=20) assert x2.data.maxlen == 20 for i in range(10): x.append(c.submit(inc, i)) while len(s.wants_what[c2.id]) < 10: yield gen.sleep(0.01) for i in range(10, 20): x.append(c.submit(inc, i)) while len(x2) < 20: yield gen.sleep(0.01) yield gen.sleep(0.1) assert len(x2) == 20 # They stay this long after a delay assert len(s.task_state) == 20 yield c2._shutdown()
def test_multiple_maxlen(c, s, a, b): c2 = Client((s.ip, s.port), start=False) yield c2._start() x = c.channel('x', maxlen=10) assert x.futures.maxlen == 10 x2 = c2.channel('x', maxlen=20) assert x2.futures.maxlen == 20 for i in range(10): x.append(c.submit(inc, i)) while len(s.wants_what[c2.id]) < 10: yield gen.sleep(0.01) for i in range(10, 20): x.append(c.submit(inc, i)) while len(x2) < 20: yield gen.sleep(0.01) yield gen.sleep(0.1) assert len(x2) == 20 # They stay this long after a delay assert len(s.task_state) == 20 yield c2._shutdown()
def test_values(c, s, a, b): c2 = Client((s.ip, s.port), start=False) yield c2._start() x = c.channel('x') x2 = c2.channel('x') data = [123, 'Hello!', {'x': [1, 2, 3]}] for item in data: x.append(item) while len(x2.data) < 3: yield gen.sleep(0.01) assert list(x2.data) == data yield c2._shutdown()