File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -885,7 +885,10 @@ class PyMongoTestCase(unittest.TestCase):
885
885
def __init__ (self , methodName = "runTest" ):
886
886
super ().__init__ (methodName )
887
887
try :
888
- self .loop = asyncio .get_event_loop ()
888
+ with warnings .catch_warnings ():
889
+ # Ignore DeprecationWarning: There is no current event loop
890
+ warnings .simplefilter ("ignore" , DeprecationWarning )
891
+ self .loop = asyncio .get_event_loop ()
889
892
except RuntimeError :
890
893
self .loop = asyncio .new_event_loop ()
891
894
asyncio .set_event_loop (self .loop )
Original file line number Diff line number Diff line change @@ -887,7 +887,10 @@ class AsyncPyMongoTestCase(unittest.TestCase):
887
887
def __init__ (self , methodName = "runTest" ):
888
888
super ().__init__ (methodName )
889
889
try :
890
- self .loop = asyncio .get_event_loop ()
890
+ with warnings .catch_warnings ():
891
+ # Ignore DeprecationWarning: There is no current event loop
892
+ warnings .simplefilter ("ignore" , DeprecationWarning )
893
+ self .loop = asyncio .get_event_loop ()
891
894
except RuntimeError :
892
895
self .loop = asyncio .new_event_loop ()
893
896
asyncio .set_event_loop (self .loop )
You can’t perform that action at this time.
0 commit comments