PYTHON-6012 - Consolidate TopologySettings into a single shared class - #3016
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the driver’s TopologySettings implementation to reduce duplication between synchronous and asynchronous clients by extracting shared behavior into a new shared base class, and updates affected tests to import TOPOLOGY_TYPE from its canonical module.
Changes:
- Introduce
pymongo/settings_shared.pywith_BaseTopologySettingscontaining the shared TopologySettings logic. - Update sync/async
TopologySettingsto inherit from the shared base and delegate initialization. - Update sync/async client tests to import
TOPOLOGY_TYPEfrompymongo.topology_descriptioninstead of the settings modules.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/test_client.py | Update import source for TOPOLOGY_TYPE to match refactor. |
| test/asynchronous/test_client.py | Update import source for TOPOLOGY_TYPE to match refactor. |
| pymongo/synchronous/settings.py | Convert TopologySettings to a thin subclass of the shared base. |
| pymongo/asynchronous/settings.py | Convert TopologySettings to a thin subclass of the shared base. |
| pymongo/settings_shared.py | New shared base class factoring out common TopologySettings behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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-6012
Changes in this PR
Refactored
ToplogySettingsto use a shared generic base class, leaving only Pool and Monitor type info to differ between async and sync.Test Plan
Existing test suite.
Checklist
Checklist for Author
Checklist for Reviewer