fix: remove remaining flaky wall-clock test assertions - #2159
Merged
qinxuye merged 1 commit intoSep 6, 2026
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors several asynchronous tests to eliminate flaky time-based assertions and background ticker tasks. Instead of relying on arbitrary sleep durations and measuring elapsed time, the tests now use deterministic synchronization primitives such as threading.Event and asyncio.Event along with explicit pytest.mark.timeout decorators. This ensures robust and reliable test execution across different environments. There are no review comments to address, and I have no additional feedback to provide.
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.
Nine remaining tests could fail when a CI worker was descheduled: four event-loop tests used short sleeps or ticker counts, and five timeout tests imposed 3–5 second wall-clock ceilings.
Replace the event-loop timing assertions with worker-entry and release events (or the existing pool checkout gate). Keep checking timeout outcomes and configured deadlines, with 30-second test guards for hangs. Preserve the thread-CPU performance regression tests.
Validation: 144 relevant tests passed across two runs; Ruff lint, format checks, and git diff --check passed. The API run used an isolated import path because the shared editable virtualenv otherwise loaded both checkouts.
Follow-up to #2156, which merged while this audit was in progress.