Ejemplo n.º 1
0
 def f2():
     self.assertEqual(self.active_contexts, ['c1', 'c2'])
     yield gen.Task(self.io_loop.add_callback)
     self.assertEqual(self.active_contexts, ['c1', 'c2'])
Ejemplo n.º 2
0
 def tornado_coroutine():
     yield gen.Task(self.io_loop.add_callback)
     raise gen.Return(42)
Ejemplo n.º 3
0
 def f():
     yield gen.Task(self.io_loop.add_callback)
     1 / 0
Ejemplo n.º 4
0
 def f():
     with ExceptionStackContext(lambda t, v, tb: False):
         yield gen.Task(self.io_loop.add_callback)
Ejemplo n.º 5
0
 def f():
     yield gen.Task(self.io_loop.add_callback)
     self.stop(42)
     raise gen.Return()
Ejemplo n.º 6
0
 def f2():
     yield gen.Task(self.io_loop.add_callback)
     raise gen.Return(43)
Ejemplo n.º 7
0
 def inner(callback):
     yield gen.Task(self.io_loop.add_callback)
     1 / 0
Ejemplo n.º 8
0
 def test_task_transfer_stack_context(self):
     yield gen.Task(self.function_with_stack_context)
     self.assertEqual(self.named_contexts, [])
Ejemplo n.º 9
0
 def prepare(self):
     yield gen.Task(IOLoop.current().add_callback)
     raise HTTPError(403)
Ejemplo n.º 10
0
 def f():
     try:
         yield gen.Task(fail_task)
         raise Exception("did not get expected exception")
     except ZeroDivisionError:
         self.stop()
Ejemplo n.º 11
0
 def get(self):
     self.chunks.append('2')
     yield gen.Task(IOLoop.current().add_callback)
     self.chunks.append('3')
     yield gen.Task(IOLoop.current().add_callback)
     self.write(''.join(self.chunks))
Ejemplo n.º 12
0
 def prepare(self):
     self.chunks = []
     yield gen.Task(IOLoop.current().add_callback)
     self.chunks.append('1')
Ejemplo n.º 13
0
 def get(self):
     # This test depends on the order of the two decorators.
     io_loop = self.request.connection.stream.io_loop
     yield gen.Task(io_loop.add_callback)
     raise Exception("oops")
Ejemplo n.º 14
0
 def get(self):
     io_loop = self.request.connection.stream.io_loop
     client = AsyncHTTPClient(io_loop=io_loop)
     response = yield gen.Task(client.fetch, self.get_argument('url'))
     response.rethrow()
     self.finish(b"got response: " + response.body)
Ejemplo n.º 15
0
 def f():
     yield gen.Task(self.io_loop.add_timeout, self.io_loop.time() + 1)