def test_arrive_threaded(self): r = ResponseManager() r.pending(100) def fn(): time.sleep(0) r.arrived(100, sentinel.foo) th = gevent.Greenlet(fn) th.start() ret = r. await (100, 1) th.join(1) eq_(ret, sentinel.foo)
def test_arrive_threaded(self): r = ResponseManager() r.pending(100) def fn(): time.sleep(0) r.arrived(100, sentinel.foo) th = gevent.Greenlet(fn) th.start() ret = r.await(100, 1) th.join(1) eq_(ret, sentinel.foo)
def test_arrive_instant(self): r = ResponseManager() r.pending(100) r.arrived(100, sentinel.foo) ret = r. await (100) eq_(ret, sentinel.foo)
def test_set_exception(self): r = ResponseManager() r.pending(100) r.set_exception(100, RuntimeError("foo")) r. await (100)
def test_timeout(self): r = ResponseManager() r.pending(100) r. await (100, 0)
def test_arrive_instant(self): r = ResponseManager() r.pending(100) r.arrived(100, sentinel.foo) ret = r.await(100) eq_(ret, sentinel.foo)
def test_set_exception(self): r = ResponseManager() r.pending(100) r.set_exception(100, RuntimeError("foo")) r.await(100)
def test_timeout(self): r = ResponseManager() r.pending(100) r.await(100, 0)