Skip to content

PYTHON-6020 Move _have_dnspython into uri_parser_shared.py - #3032

Merged
sleepyStick merged 4 commits into
mongodb:mainfrom
sleepyStick:PYTHON-6020
Sep 2, 2026
Merged

PYTHON-6020 Move _have_dnspython into uri_parser_shared.py#3032
sleepyStick merged 4 commits into
mongodb:mainfrom
sleepyStick:PYTHON-6020

Conversation

@sleepyStick

Copy link
Copy Markdown
Contributor

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

  • Did you update the changelog (if necessary)?
  • Is there test coverage?
  • Is any followup work tracked in a JIRA ticket? If so, add link(s).

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sleepyStick
sleepyStick marked this pull request as ready for review September 1, 2026 22:24
@sleepyStick
sleepyStick requested a review from a team as a code owner September 1, 2026 22:24
@sleepyStick
sleepyStick requested review from NoahStapp and a lite review from Copilot September 1, 2026 22:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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() to pymongo/uri_parser_shared.py and removed the previous import from pymongo.asynchronous.srv_resolver.
  • Removed duplicated _have_dnspython() definitions from both pymongo/asynchronous/srv_resolver.py and pymongo/synchronous/srv_resolver.py.
  • Updated SRV polling tests (sync + async) to import _have_dnspython() from pymongo.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 aclark4life left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this move down to right above _unquoted_percents ?

@sleepyStick

Copy link
Copy Markdown
Contributor Author

Can this move down to right above _unquoted_percents ?

done! lol i was honestly debating between where it was and right above _unquoted_percents myself! originally opted for the top because it was an import haha

@sleepyStick
sleepyStick merged commit 003c9cc into mongodb:main Sep 2, 2026
90 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants