Example #1
0
 def setUp(self):
     self.original_build_class = __build_class__
     builtins.__build_class__ = __build_cinder_class__
     # ensure clean classloader/vtable slate for all tests
     cinder.clear_classloader_caches()
     # ensure our async tests don't change the event loop policy
     policy = maybe_get_event_loop_policy()
     self.addCleanup(lambda: asyncio.set_event_loop_policy(policy))
Example #2
0
 def close_loop(loop):
     executor = loop._default_executor
     if executor is not None:
         executor.shutdown(wait=True)
     loop.close()
     policy = support.maybe_get_event_loop_policy()
     if policy is not None:
         try:
             watcher = policy.get_child_watcher()
         except NotImplementedError:
             # watcher is not implemented by EventLoopPolicy, e.g. Windows
             pass
         else:
             if isinstance(watcher, asyncio.ThreadedChildWatcher):
                 threads = list(watcher._threads.values())
                 for thread in threads:
                     thread.join()
Example #3
0
 def get_asyncio_events__event_loop_policy(self):
     return support.maybe_get_event_loop_policy()
Example #4
0
 def get_asyncio_events__event_loop_policy(self):
     return support.maybe_get_event_loop_policy()
Example #5
0
 def get_asyncio_events__event_loop_policy(self):
     self.try_get_module('asyncio')
     return support.maybe_get_event_loop_policy()