From d5d09957768f0378b545a7964a11519a220d8b84 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 17 Apr 2025 09:51:55 -0500 Subject: [PATCH] MOTOR-1453 & MOTOR-1454 Update expected attributes tests and links (#331) --- doc/migrate-to-motor-3.rst | 2 +- doc/requirements.rst | 2 +- synchro/__init__.py | 5 ++--- synchro/synchrotest.py | 12 +++++++++++- test/tornado_tests/test_motor_core.py | 6 ++++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/doc/migrate-to-motor-3.rst b/doc/migrate-to-motor-3.rst index 407de632..dd289320 100644 --- a/doc/migrate-to-motor-3.rst +++ b/doc/migrate-to-motor-3.rst @@ -413,7 +413,7 @@ custom types to BSON, the :class:`~bson.codec_options.TypeCodec` and :class:`~bson.codec_options.TypeRegistry` APIs may be a suitable alternative. For more information, see the `Custom Types documentation`_. -.. _Custom Types documentation: https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/#std-label-pymongo-custom-types +.. _Custom Types documentation: https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/ GridFS changes -------------- diff --git a/doc/requirements.rst b/doc/requirements.rst index ba615341..afddeff0 100644 --- a/doc/requirements.rst +++ b/doc/requirements.rst @@ -79,7 +79,7 @@ Use `the PyMongo compatibility matrix`_ to determine what MongoDB version is supported by PyMongo. Use the compatibility matrix above to determine what MongoDB version Motor supports. -.. _the PyMongo compatibility matrix: https://mongodb.com/docs/drivers/pymongo#compatibility +.. _the PyMongo compatibility matrix: https://www.mongodb.com/docs/languages/python/pymongo-driver/current/reference/compatibility/ Motor and Tornado ````````````````` diff --git a/synchro/__init__.py b/synchro/__init__.py index b32355e2..4e4c37ed 100644 --- a/synchro/__init__.py +++ b/synchro/__init__.py @@ -56,11 +56,11 @@ from pymongo import ( saslprep, server_selectors, server_type, - srv_resolver, ssl_support, uri_parser, write_concern, ) +from pymongo.synchronous import srv_resolver # Added for API compat with pymongo. try: @@ -104,7 +104,6 @@ from pymongo.results import * from pymongo.results import _WriteResult from pymongo.saslprep import * from pymongo.server_selectors import * -from pymongo.srv_resolver import _resolve, _SrvResolver from pymongo.ssl_support import * from pymongo.synchronous.client_session import _TxnState from pymongo.synchronous.encryption import _Encrypter @@ -112,10 +111,10 @@ from pymongo.synchronous.monitor import * from pymongo.synchronous.pool import _PoolClosedError from pymongo.synchronous.server import * from pymongo.synchronous.settings import * +from pymongo.synchronous.srv_resolver import _have_dnspython, _resolve, _SrvResolver from pymongo.synchronous.topology import * from pymongo.topology_description import * from pymongo.uri_parser import * -from pymongo.uri_parser import _have_dnspython from pymongo.write_concern import * from tornado.ioloop import IOLoop diff --git a/synchro/synchrotest.py b/synchro/synchrotest.py index b58425da..62a6a3e0 100644 --- a/synchro/synchrotest.py +++ b/synchro/synchrotest.py @@ -207,6 +207,16 @@ excluded_tests = [ # Motor does not allow calling to_list on a tailable cursor. "TestCursor.test_max_await_time_ms", "TestCursor.test_to_list_tailable", + # Newer tests not implemented in Motor + "TestClient.test_repr_srv_host", + "TestGridfs.test_delete_by_name", + "TestGridfs.test_rename_by_name", + "TestGridfsDeleteByName.*", + "TestGridfsRenameByName.*", + "TestMongosAndReadPreference.test_read_preference_hedge_deprecated", + "TestUnifiedTestFormatValidPassKmsProvidersExplicitKmsCredentials.*", + "TestUnifiedTestFormatValidPassKmsProvidersMixedKmsCredentialFields.*", + "TestUnifiedTestFormatValidPassKmsProvidersPlaceholderKmsCredentials.*", ] @@ -333,7 +343,7 @@ if __name__ == "__main__": "pymongo.encryption_options", "pymongo.mongo_client", "pymongo.database", - "pymongo.srv_resolver", + "pymongo.synchronous.srv_resolver", "pymongo.synchronous.collection", "pymongo.synchronous.client_session", "pymongo.synchronous.command_cursor", diff --git a/test/tornado_tests/test_motor_core.py b/test/tornado_tests/test_motor_core.py index 72558189..65ff4ed2 100644 --- a/test/tornado_tests/test_motor_core.py +++ b/test/tornado_tests/test_motor_core.py @@ -31,9 +31,11 @@ motor_only = set(["delegate", "get_io_loop", "io_loop", "wrap"]) pymongo_only = set(["next"]) +pymongo_gridfs_only = set(["delete_by_name", "rename_by_name"]) + motor_client_only = motor_only.union(["open"]) -pymongo_client_only = set([]).union(pymongo_only) +pymongo_client_only = set(["eq_props"]).union(pymongo_only) pymongo_database_only = set([]).union(pymongo_only) @@ -113,7 +115,7 @@ class MotorCoreTestGridFS(MotorTest): motor_gridfs_only = set(["collection"]).union(motor_only) self.assertEqual( - attrs(GridFSBucket(env.sync_cx.test)), + attrs(GridFSBucket(env.sync_cx.test)) - pymongo_gridfs_only, attrs(MotorGridFSBucket(self.cx.test)) - motor_gridfs_only, )