Skip to content

Conversation

@pareshjoshij
Copy link
Contributor

@pareshjoshij pareshjoshij commented Nov 26, 2025

Fixes #1696
Refactor check_animate_output to use a polling loop instead of time.sleep(). This eliminates race conditions causing flaky failures on CI runners and speeds up local execution.

  • Removed rigid sleep calculations based on frame count.

  • Added while loop to capture stderr until expected length is reached.

  • Simplified test_env_no_animate sleep logic.

  • I have added a news fragment under changelog.d/ (if the patch affects the end users)

Summary of changes

Replaced the unstable time.sleep() synchronization in check_animate_output (inside tests/test_animate.py) with a polling loop.

Instead of waiting a fixed duration (which causes flakes on slow CI runners), the test now waits for the exact number of characters to appear in stderr. This makes the test deterministic and significantly faster on local machines.

Test plan

Tested by running the animation tests locally:

pytest tests/test_animate.py

pareshjoshij and others added 3 commits November 26, 2025 23:02
efactor `check_animate_output` to use a polling loop instead of `time.sleep()`.
This eliminates race conditions causing flaky failures on CI runners and speeds up local execution.

- Removed rigid sleep calculations based on frame count.
- Added `while` loop to capture stderr until expected length is reached.
- Simplified `test_env_no_animate` sleep logic.
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.

Flaky Tests: Replace time.sleep race conditions in test_animate.py with deterministic assertions

1 participant