Esempio n. 1
0
    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)
Esempio n. 2
0
    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)
Esempio n. 3
0
 def test_arrive_instant(self):
     r = ResponseManager()
     r.pending(100)
     r.arrived(100, sentinel.foo)
     ret = r. await (100)
     eq_(ret, sentinel.foo)
Esempio n. 4
0
 def test_set_exception(self):
     r = ResponseManager()
     r.pending(100)
     r.set_exception(100, RuntimeError("foo"))
     r. await (100)
Esempio n. 5
0
    def test_timeout(self):
        r = ResponseManager()

        r.pending(100)

        r. await (100, 0)
Esempio n. 6
0
 def test_arrive_instant(self):
     r = ResponseManager()
     r.pending(100)
     r.arrived(100, sentinel.foo)
     ret = r.await(100)
     eq_(ret, sentinel.foo)
Esempio n. 7
0
 def test_set_exception(self):
     r = ResponseManager()
     r.pending(100)
     r.set_exception(100, RuntimeError("foo"))
     r.await(100)
Esempio n. 8
0
    def test_timeout(self):
        r = ResponseManager()

        r.pending(100)

        r.await(100, 0)