PYTHON-6020 Move _have_dnspython into uri_parser_shared.py - #3032
Open
sleepyStick wants to merge 2 commits into
Open
PYTHON-6020 Move _have_dnspython into uri_parser_shared.py#3032sleepyStick wants to merge 2 commits into
sleepyStick wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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