diff --git a/pyproject.toml b/pyproject.toml index 6cf73692..76861070 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,7 +103,10 @@ filterwarnings = [ "ignore:GridOut property 'aliases' is deprecated and will be removed in PyMongo 5.0:DeprecationWarning", # From older versions aiohttp. "ignore:\"@coroutine\" decorator is deprecated since Python 3.8:DeprecationWarning", - "ignore:The loop argument is deprecated since Python 3.8:DeprecationWarning" + "ignore:The loop argument is deprecated since Python 3.8:DeprecationWarning", + # TODO: Remove both of these in https://jira.mongodb.org/browse/PYTHON-4731 + "ignore:Unclosed AsyncMongoClient*", + "ignore:Unclosed MongoClient*", ] [tool.ruff] diff --git a/synchro/__init__.py b/synchro/__init__.py index d58c16f0..965ecf98 100644 --- a/synchro/__init__.py +++ b/synchro/__init__.py @@ -93,6 +93,8 @@ from pymongo.monitoring import _LISTENERS, _Listeners from pymongo.ocsp_cache import _OCSPCache from pymongo.operations import * +from pymongo.pool import * +from pymongo.pool import Connection, Pool from pymongo.read_concern import * from pymongo.read_preferences import * from pymongo.read_preferences import _ServerMode @@ -107,8 +109,7 @@ from pymongo.synchronous.monitor import * from pymongo.synchronous.periodic_executor import * from pymongo.synchronous.periodic_executor import _EXECUTORS -from pymongo.synchronous.pool import * -from pymongo.synchronous.pool import Connection, Pool, _PoolClosedError +from pymongo.synchronous.pool import _PoolClosedError from pymongo.synchronous.server import * from pymongo.synchronous.settings import * from pymongo.synchronous.topology import * diff --git a/test/asyncio_tests/test_asyncio_collection.py b/test/asyncio_tests/test_asyncio_collection.py index 5be6a7cc..432a6a04 100644 --- a/test/asyncio_tests/test_asyncio_collection.py +++ b/test/asyncio_tests/test_asyncio_collection.py @@ -270,7 +270,7 @@ def test_sub_collection(self): @env.require_no_standalone @asyncio_test async def test_async_create_encrypted_collection(self): - c = self.collection + c = self.cx KMS_PROVIDERS = {"local": {"key": b"\x00" * 96}} self.cx.drop_database("db") async with AsyncIOMotorClientEncryption( @@ -290,7 +290,7 @@ async def test_async_create_encrypted_collection(self): @env.require_version_min(8, 0, -1, -1) @asyncio_test async def test_async_encrypt_expression(self): - c = self.collection + c = self.cx KMS_PROVIDERS = {"local": {"key": b"\x00" * 96}} self.cx.drop_database("db") async with AsyncIOMotorClientEncryption( diff --git a/test/asyncio_tests/test_asyncio_cursor.py b/test/asyncio_tests/test_asyncio_cursor.py index 61ea8d24..b348b703 100644 --- a/test/asyncio_tests/test_asyncio_cursor.py +++ b/test/asyncio_tests/test_asyncio_cursor.py @@ -585,7 +585,7 @@ async def test_context_manager(self): @asyncio_test async def test_generate_keys(self): - c = self.collection + c = self.cx KMS_PROVIDERS = {"local": {"key": b"\x00" * 96}} async with motor_asyncio.AsyncIOMotorClientEncryption( diff --git a/test/tornado_tests/test_motor_collection.py b/test/tornado_tests/test_motor_collection.py index 3038b664..4a30ecd1 100644 --- a/test/tornado_tests/test_motor_collection.py +++ b/test/tornado_tests/test_motor_collection.py @@ -272,7 +272,7 @@ def test_sub_collection(self): @gen_test async def test_async_create_encrypted_collection(self): await self.db.drop_collection("test_collection") - c = self.collection + c = self.cx KMS_PROVIDERS = {"local": {"key": b"\x00" * 96}} self.cx.drop_database("db") async with motor.MotorClientEncryption( @@ -292,7 +292,7 @@ async def test_async_create_encrypted_collection(self): @env.require_version_min(8, 0, -1, -1) @gen_test async def test_async_encrypt_expression(self): - c = self.collection + c = self.cx KMS_PROVIDERS = {"local": {"key": b"\x00" * 96}} self.cx.drop_database("db") async with motor.MotorClientEncryption( diff --git a/test/tornado_tests/test_motor_cursor.py b/test/tornado_tests/test_motor_cursor.py index 1402ab4c..16d96146 100644 --- a/test/tornado_tests/test_motor_cursor.py +++ b/test/tornado_tests/test_motor_cursor.py @@ -518,7 +518,7 @@ async def test_raw_batches(self): @gen_test async def test_generate_keys(self): - c = self.collection + c = self.cx KMS_PROVIDERS = {"local": {"key": b"\x00" * 96}} async with motor.MotorClientEncryption(