MCPcopy
hub / github.com/tornadoweb/tornado / test_set_default_executor

Method test_set_default_executor

tornado/test/ioloop_test.py:554–572  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

552
553 @gen_test
554 def test_set_default_executor(self):
555 count = [0]
556
557 class MyExecutor(futures.ThreadPoolExecutor):
558 def submit(self, func, *args):
559 count[0] += 1
560 return super().submit(func, *args)
561
562 event = threading.Event()
563
564 def sync_func():
565 event.set()
566
567 executor = MyExecutor(1)
568 loop = IOLoop.current()
569 loop.set_default_executor(executor)
570 yield loop.run_in_executor(None, sync_func)
571 self.assertEqual(1, count[0])
572 self.assertTrue(event.is_set())
573
574
575class TestIOLoopRunSync(unittest.TestCase):

Callers

nothing calls this directly

Calls 5

is_setMethod · 0.95
MyExecutorClass · 0.85
currentMethod · 0.80
set_default_executorMethod · 0.45
run_in_executorMethod · 0.45

Tested by

no test coverage detected