Get the test suite's global event loop.
()
| 839 | |
| 840 | |
| 841 | def 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 | |
| 860 | class PyMongoTestCase(unittest.TestCase): |
no outgoing calls
no test coverage detected