Skip to content

Conversation

@NoahStapp
Copy link
Contributor

No description provided.

def test_pymongo_submodule_attributes(self):
import pymongo

self.assertTrue(hasattr(pymongo, "uri_parser"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this test fail before this fix? Also can we add:

 self.assertTrue(pymongo.uri_parser) self.assertTrue(pymongo.uri_parser.parse_uri))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this assertion fails before this fix.

"WriteConcern",
"has_c",
"timeout",
"uri_parser",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right fix? Back in 4.7 uri_parser wasn't part of __all__ and this bug didn't exist. Perhaps we shouldn't include uri_parser here and instead we should import pymongo.uri_parser like we did before.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried about unintentional side effects of including it in __all__.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, we don't actually need to include uri_parser in __all__.

@NoahStapp NoahStapp merged commit e6a4a71 into mongodb:master Apr 15, 2025
42 of 46 checks passed
ShaneHarvey pushed a commit to ShaneHarvey/mongo-python-driver that referenced this pull request Apr 22, 2025
ShaneHarvey added a commit that referenced this pull request Apr 23, 2025
…2283) (#2302) Co-authored-by: Noah Stapp <noah.stapp@mongodb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants