Python tornado.gen.multi() Examples

The following are 8 code examples of tornado.gen.multi(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tornado.gen , or try the search function .
Example #1
Source File: gen_test.py    From opendevops with GNU General Public License v3.0 5 votes vote down vote up
def test_multi_moment(self):
        # Test gen.multi with moment
        # now that it's not a real Future
        @gen.coroutine
        def wait_a_moment():
            result = yield gen.multi([gen.moment, gen.moment])
            raise gen.Return(result)

        loop = self.get_new_ioloop()
        result = loop.run_sync(wait_a_moment)
        self.assertEqual(result, [None, None]) 
Example #2
Source File: ioloop_test.py    From opendevops with GNU General Public License v3.0 5 votes vote down vote up
def test_init_close_race(self):
        # Regression test for #2367
        def f():
            for i in range(10):
                loop = IOLoop()
                loop.close()

        yield gen.multi([self.io_loop.run_in_executor(None, f) for i in range(2)])


# Deliberately not a subclass of AsyncTestCase so the IOLoop isn't
# automatically set as current. 
Example #3
Source File: gen_test.py    From teleport with Apache License 2.0 5 votes vote down vote up
def test_multi_moment(self):
        # Test gen.multi with moment
        # now that it's not a real Future
        @gen.coroutine
        def wait_a_moment():
            result = yield gen.multi([gen.moment, gen.moment])
            raise gen.Return(result)

        loop = self.get_new_ioloop()
        result = loop.run_sync(wait_a_moment)
        self.assertEqual(result, [None, None]) 
Example #4
Source File: ioloop_test.py    From teleport with Apache License 2.0 5 votes vote down vote up
def test_init_close_race(self):
        # Regression test for #2367
        def f():
            for i in range(10):
                loop = IOLoop()
                loop.close()

        yield gen.multi([self.io_loop.run_in_executor(None, f) for i in range(2)])


# Deliberately not a subclass of AsyncTestCase so the IOLoop isn't
# automatically set as current. 
Example #5
Source File: gen_test.py    From pySINDy with MIT License 5 votes vote down vote up
def test_multi_moment(self):
        # Test gen.multi with moment
        # now that it's not a real Future
        @gen.coroutine
        def wait_a_moment():
            result = yield gen.multi([gen.moment, gen.moment])
            raise gen.Return(result)

        loop = self.get_new_ioloop()
        result = loop.run_sync(wait_a_moment)
        self.assertEqual(result, [None, None]) 
Example #6
Source File: ioloop_test.py    From pySINDy with MIT License 5 votes vote down vote up
def test_init_close_race(self):
        # Regression test for #2367
        def f():
            for i in range(10):
                loop = IOLoop()
                loop.close()

        yield gen.multi([self.io_loop.run_in_executor(None, f) for i in range(2)])


# Deliberately not a subclass of AsyncTestCase so the IOLoop isn't
# automatically set as current. 
Example #7
Source File: gen_test.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def test_multi_moment(self):
        # Test gen.multi with moment
        # now that it's not a real Future
        @gen.coroutine
        def wait_a_moment():
            result = yield gen.multi([gen.moment, gen.moment])
            raise gen.Return(result)

        loop = self.get_new_ioloop()
        result = loop.run_sync(wait_a_moment)
        self.assertEqual(result, [None, None]) 
Example #8
Source File: ioloop_test.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def test_init_close_race(self):
        # Regression test for #2367
        def f():
            for i in range(10):
                loop = IOLoop()
                loop.close()

        yield gen.multi([self.io_loop.run_in_executor(None, f) for i in range(2)])


# Deliberately not a subclass of AsyncTestCase so the IOLoop isn't
# automatically set as current.