MOTOR-1214 Ignore IOLoop.current deprecation to make synchro pass (#236)

This commit is contained in:
Shane Harvey 2023-11-09 16:45:47 -08:00 committed by GitHub
parent 4513307899
commit cb050ef3d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ DO NOT USE THIS MODULE.
import functools
import inspect
import unittest
import warnings
from typing import Generic, TypeVar
# Make e.g. "from pymongo.errors import AutoReconnect" work. Note that
@ -337,7 +338,9 @@ class Synchro(metaclass=SynchroMeta):
def partial():
return async_method(*args, **kwargs)
return IOLoop.current().run_sync(partial)
with warnings.catch_warnings(action="ignore", category=DeprecationWarning):
loop = IOLoop.current()
return loop.run_sync(partial)
return synchronized_method