MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / get_loop

Function get_loop

test/__init__.py:841–857  ·  view source on GitHub ↗

Get the test suite's global event loop.

()

Source from the content-addressed store, hash-verified

839
840
841def get_loop() -> asyncio.AbstractEventLoop:
842 """Get the test suite's global event loop."""
843 global LOOP
844 if LOOP is None:
845 try:
846 LOOP = asyncio.get_running_loop()
847 except RuntimeError:
848 # no running event loop, fallback to get_event_loop.
849 try:
850 # Ignore DeprecationWarning: There is no current event loop
851 with warnings.catch_warnings():
852 warnings.simplefilter("ignore", DeprecationWarning)
853 LOOP = asyncio.get_event_loop()
854 except RuntimeError:
855 LOOP = asyncio.new_event_loop()
856 asyncio.set_event_loop(LOOP)
857 return LOOP
858
859
860class PyMongoTestCase(unittest.TestCase):

Callers 3

_callAsyncMethod · 0.70
_callMaybeAsyncMethod · 0.70
setupFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected