PYTHON-5925 Fix flaky SRV polling monitor tests#2924
Merged
Conversation
Fixes the flakiness in test_dns_failures_logging and removes the now-unnecessary PYTHON-5315 flaky markers on the SRV seedlist recovery tests.
Documents the FunctionCallRecorder sync/async recording-timing difference, and drops a redundant re-check that duplicated the preceding wait_until's condition.
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces flakiness in SRV polling monitor tests by making log assertions resilient to timing, and by improving a shared test utility so recorded async calls represent coroutines that actually completed.
Changes:
- Update
FunctionCallRecorderto record coroutine invocations only after the coroutine finishes (success/exception/cancellation), and add descriptor support for method-style binding. - Fix
test_dns_failures_logging(sync/async) by waiting until the expected “SRV monitor check failed” log record appears instead of asserting immediately. - Remove now-unnecessary
@flakymarkers from SRV seedlist recovery tests (sync/async).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/utils_shared.py | Refines FunctionCallRecorder semantics for async functions and adds __get__ for method binding. |
| test/test_srv_polling.py | Replaces immediate log-count assertion with wait_until; removes @flaky usage. |
| test/asynchronous/test_srv_polling.py | Async equivalent: uses async_wait_until; removes @flaky usage. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
NoahStapp
approved these changes
Jul 10, 2026
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-5925
Changes in this PR
Fixes the flakiness in
test_dns_failures_logging. Also removes the now-unnecessary@flakymarkers for PYTHON-5315 on the SRV seedlist recovery tests, since the underlying test-harness race conditions are resolved.Test Plan
Verified locally (repeated runs) and Evergreen patch builds, including a full-matrix confirmation run targeting the previously-failing variants (win32/win64/pyopenssl-win64/etc.). The remaining failures there are pre-existing and unrelated to this change.
Checklist
Checklist for Author
Checklist for Reviewer