PYTHON-5791 - test_list_database_names should not check ordering#2751
Merged
NoahStapp merged 1 commit intomongodb:masterfrom Apr 13, 2026
Merged
PYTHON-5791 - test_list_database_names should not check ordering#2751NoahStapp merged 1 commit intomongodb:masterfrom
NoahStapp merged 1 commit intomongodb:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the synchronous and asynchronous test_list_database_names tests to avoid asserting on database ordering, which can vary across server versions and is not required by the specification.
Changes:
- Replace
assertEqual(db_names, cmd_names)withassertCountEqual(db_names, cmd_names)in the synchronous client test. - Apply the same change to the asynchronous client test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
test/test_client.py |
Makes test_list_database_names order-insensitive by comparing contents only. |
test/asynchronous/test_client.py |
Mirrors the order-insensitive assertion change for the async client test. |
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-5791
Changes in this PR
Latest server version changed the order of databases returned by test_list_database_names. Our test explicitly checks for order despite the spec not requiring it to do so. Requiring identical ordering is both fragile and does not affect correctness.
Test Plan
Changed test to verify contents only and not ordering.
Checklist
Checklist for Author
[] Did you update the changelog (if necessary)?Checklist for Reviewer