Skip to content

PYTHON-5975 Fix missing await calls in async test suite - #3029

Draft
blink1073 wants to merge 1 commit into
mongodb:mainfrom
blink1073:claude/python-5975-jira-ticket-171e7d
Draft

PYTHON-5975 Fix missing await calls in async test suite#3029
blink1073 wants to merge 1 commit into
mongodb:mainfrom
blink1073:claude/python-5975-jira-ticket-171e7d

Conversation

@blink1073

Copy link
Copy Markdown
Member

PYTHON-5975

Changes in this PR

  • Replaced ResetPoolThread in test_reset_during_update_pool with the existing ConcurrentRunner test helper, since the raw threading.Thread called its async _run() without awaiting it (and a Thread.run() has no event loop to run it in anyway).
  • Fixed InsertEventListener.succeeded() so it actually runs the configureFailPoint admin command instead of discarding an unawaited coroutine. succeeded() is invoked synchronously by the shared command-monitoring dispatch code and can't become async, so the async path now schedules the command via create_task.

Test Plan

  • just synchro, just lint, and mypy --config-file mypy_test.ini test all pass with no new errors.
  • test/test_client.py::TestClient::test_reset_during_update_pool passes against a local standalone server; confirmed it also passes with the require_sync skip temporarily removed, proving the ConcurrentRunner-based fix genuinely works under async execution.
  • Full test/test_client.py and test/test_retryable_writes.py suites (sync and async) pass locally; replica-set-gated tests skip against the standalone server available here. InsertEventListener's sync-mode behavior is unchanged from before this PR, so no regression risk there.

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)? Not needed — test-only fix, no user-facing behavior change.
  • Is there test coverage?
  • Is any followup work tracked in a JIRA ticket? If so, add link(s). None needed.

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?

ResetPoolThread.run() never awaited its async _run(), so the pool-reset
loop never executed during test_reset_during_update_pool; replace it
with the existing ConcurrentRunner helper, which runs correctly under
both sync and async execution.

InsertEventListener.succeeded() never awaited its admin.command() call,
so the coroutine was discarded and the failCommand fail point was never
configured. succeeded() is invoked synchronously by the shared command
monitoring dispatch code, so it can't become async; schedule the
command via create_task on the async path instead.
@blink1073
blink1073 force-pushed the claude/python-5975-jira-ticket-171e7d branch from 068b8dc to b182c9b Compare September 1, 2026 11:58
@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!

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.

1 participant