Skip to content

PYTHON-4925 Fix test bugs in $$matchAsDocument and $$matchAsRoot #1988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Nov 5, 2024

Conversation

ShaneHarvey
Copy link
Member

@ShaneHarvey ShaneHarvey commented Oct 31, 2024

PYTHON-4925 Fix test bugs in $$matchAsDocument and $$matchAsRoot

Also:

  • Fixes a bug where the driverConnectionId field was missing from "server heartbeat failed" log messages.
  • Avoids sending "upsert": False since various client.bulkWrite spec tests assume this field is only sent when it's True.

Implementation for mongodb/specifications#1706

@blink1073
Copy link
Member

FAILED test/test_discovery_and_monitoring.py::TestUnifiedLoggingStandalone::test_Successful_heartbeat - AssertionError: 'topologyId' not found in {'driverConnectionId': 1, 'serverHost': 'localhost', 'serverPort': 27017, 'awaited': False, 'message': 'Server heartbeat started'}
FAILED test/test_discovery_and_monitoring.py::TestUnifiedLoggingStandalone::test_Topology_lifecycle - AssertionError: 'topologyId' not found in {'message': 'Starting topology monitoring'}

@ShaneHarvey
Copy link
Member Author

This should be ready for review now, I'm expecting the tests to pass.

@blink1073
Copy link
Member

Just some type checking left:

pymongo/operations.py:392: error: Argument 3 to "add_replace" of "_AsyncBulk"
has incompatible type "Optional[bool]"; expected "bool"  [arg-type]
Installing missing stub packages:
/home/runner/.local/share/hatch/env/virtual/pymongo/EKb5j68n/typing/bin/python -m pip install types-Pygments types-requests
                self._upsert,
                ^~~~~~~~~~~~


Found 4 errors in 1 file (checked 140 source files)
pymongo/operations.py:392: error: Argument 3 to "add_replace" of "_Bulk" has
incompatible type "Optional[bool]"; expected "bool"  [arg-type]
                self._upsert,
                ^~~~~~~~~~~~
pymongo/operations.py:696: error: Argument 4 to "add_update" of "_AsyncBulk"
has incompatible type "Optional[bool]"; expected "bool"  [arg-type]
                self._upsert,
                ^~~~~~~~~~~~
pymongo/operations.py:696: error: Argument 4 to "add_update" of "_Bulk" has
incompatible type "Optional[bool]"; expected "bool"  [arg-type]
                self._upsert,
                ^~~~~~~~~~~~

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

LGTM!

@ShaneHarvey ShaneHarvey merged commit 0733c4d into mongodb:master Nov 5, 2024
43 of 45 checks passed
@ShaneHarvey ShaneHarvey deleted the PYTHON-4925 branch November 11, 2024 20:16
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.

2 participants