tests: stabilize timeout waits - #1264
Merged
Carter Tinney (cartertinney) merged 2 commits intoSep 3, 2026
Merged
Conversation
Use a dedicated bound for work scheduled across threads and event loops instead of treating it as promptly completable. Scale batch deadlines by item count so handler-manager tests retain effect-based polling without becoming load-sensitive. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Carter Tinney (cartertinney)
requested review from
Avishek (avishekpant) and
olivakar
and
a balanced review from Copilot
September 3, 2026 21:32
Copilot started reviewing on behalf of
Carter Tinney (cartertinney)
September 3, 2026 21:32
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused test-only changes consistently apply the documented timeout semantics without unresolved issues.
Pull request overview
Stabilizes timing-sensitive asynchronous tests without changing production behavior.
Changes:
- Adds timeout constants for scheduled and eventual completion.
- Scales batch waits by queued handler effects.
- Applies consistent timeout semantics across synchronous and asynchronous tests.
File summaries
| File | Description |
|---|---|
tests/unit/helpers.py |
Defines distinct timeout categories. |
tests/unit/iothub/test_sync_handler_manager.py |
Stabilizes synchronous handler waits. |
tests/unit/iothub/aio/test_async_handler_manager.py |
Stabilizes asynchronous and batch handler waits. |
tests/unit/iothub/aio/test_loop_management.py |
Extends concurrent loop-creation waits. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Avishek (avishekpant)
approved these changes
Sep 3, 2026
Carter Tinney (cartertinney)
deleted the
agents/fix-timing-flake-in-sync-handler-tests
branch
September 3, 2026 21:42
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.
What changed
Why
Handler callbacks are dispatched through runner threads, event loops, and thread-pool workers. Treating those effects as immediately completable with a 100 ms bound caused timing-sensitive failures under full-suite coverage load even though the expected exception handling completed.
The tests continue polling the actual observable effects; production behavior is unchanged.
Validation