PYTHON-6020 Move _have_dnspython into uri_parser_shared.py - #3032
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🟢 Approval recommended
The change cleanly removes duplicated logic and updates all in-repo references without introducing new dependencies or breaking existing call sites.
Pull request overview
This PR centralizes the _have_dnspython() helper in pymongo/uri_parser_shared.py so URI parsing can check for dnspython without depending on either the synchronous or asynchronous SRV resolver modules, and updates SRV polling tests accordingly.
Changes:
- Added
_have_dnspython()topymongo/uri_parser_shared.pyand removed the previous import frompymongo.asynchronous.srv_resolver. - Removed duplicated
_have_dnspython()definitions from bothpymongo/asynchronous/srv_resolver.pyandpymongo/synchronous/srv_resolver.py. - Updated SRV polling tests (sync + async) to import
_have_dnspython()frompymongo.uri_parser_shared.
File summaries
| File | Description |
|---|---|
| test/test_srv_polling.py | Update SRV polling tests to import _have_dnspython from the shared URI parser module. |
| test/asynchronous/test_srv_polling.py | Same import update for the async SRV polling tests. |
| pymongo/uri_parser_shared.py | Defines _have_dnspython() locally to avoid depending on SRV resolver modules. |
| pymongo/synchronous/srv_resolver.py | Removes duplicated _have_dnspython() implementation. |
| pymongo/asynchronous/srv_resolver.py | Removes duplicated _have_dnspython() implementation. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
aclark4life
left a comment
There was a problem hiding this comment.
Can this move down to right above _unquoted_percents ?
done! lol i was honestly debating between where it was and right above |
PYTHON-6020
Changes in this PR
the title says it all xD (not very exciting lol)
Test Plan
existing tests should pass :)
Checklist
Checklist for Author
Checklist for Reviewer