-
Notifications
You must be signed in to change notification settings - Fork 217
MOTOR-1363 - Pass correct parameter to AsyncIOMotorClientEncryption #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The tests appear to be failing now due to not closing clients correctly--do we want to wait for that ticket to be done first, or have this PR also skip those warnings for now? |
I'd say skip them. There is a separate set of failures in synchro though |
| "pymongo.synchronous.cursor", | ||
| "pymongo.synchronous.encryption", | ||
| "pymongo.synchronous.mongo_client", | ||
| "pymongo.synchronous.database", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type guards added in PYTHON-4590 have issues with the synchro import hacking when we import from pymongo.synchronous . I'll have to undo this change since the top-level pymongo.* modules don't export the private members that Motor makes use of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this is exactly the case I was worried about here:
I'm paranoid this might break apps that Mock pymongo classes but it should be fine. Anything that's mocking should inherit from our base classes anyway (instead of trying to ducktype).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A very accurate prediction, unfortunately I can't find a solution for this issue in Motor that doesn't rely on also changing PyMongo code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an option is to get the class names of the full mro and check for the desired name (in PyMongo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like type(client).__name__ == "MongoClient"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But also for subclasses:
>>> class Foo(MongoClient):
... pass
...
>>> Foo.__mro__
(<class '__main__.Foo'>, <class 'pymongo.synchronous.mongo_client.MongoClient'>, <class 'pymongo.common.BaseObject'>, <class 'typing.Generic'>, <class 'object'>)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd still run into the same issue with that, right? Since the import paths differ.
7a5fbb0 to
2538e10
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
No description provided.