test: replace polling sleeps with poll_until fixture#146
Merged
Conversation
48ab28e to
b0d317b
Compare
4 tasks
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.
Summary
Adds a
poll_untilpytest fixture intests/python/conftest.pyand rewrites 35+time.sleepcalls across 13 test files to wait on the actual condition (event delivery, webhook delivery, async-executor completion, DLQ entry, worker registration, job state) instead of fixed delays. The remainingtime.sleepcalls are intentional pacing inside task bodies (the test asserts the worker handles a slow task) — those keep their behaviour, and the rate-limit / retry tests continue to rely on time-based pacing where the assertion is about throughput.This addresses recommendation 6 from the 2026-05-08 audit (
.claude/reports/audit-2026-05-08.md).Net diff: 13 files, +186 / -112 lines.
Files touched
tests/python/conftest.py— adds thepoll_untilfixture.tests/python/test_events.py,test_webhooks.py,test_native_async.py,test_customizability.py— wait-for-event/wait-for-webhook/wait-for-executor patterns.tests/python/test_dlq.py,test_retry.py,test_periodic.py— wait-for-DLQ-entry / wait-for-completion patterns.tests/python/test_resources.py,test_worker_resources.py— wait-for-runtime-state / heartbeat publication.tests/python/test_shutdown.py,test_prefork.py,test_priority.py— wait-for-running and wait-for-completion patterns.Workflow test files (
test_workflows_*.py) are intentionally not part of this PR — they overlap with the conftest changes already in flight ontest/workflow-worker-fixtureand will be cleaned up in a follow-up to keep diffs small.Test plan
uv run python -m pytest tests/python/test_events.py tests/python/test_webhooks.py tests/python/test_native_async.py tests/python/test_customizability.py tests/python/test_dlq.py tests/python/test_periodic.py tests/python/test_retry.py tests/python/test_resources.py tests/python/test_shutdown.py tests/python/test_worker_resources.py tests/python/test_priority.py— 93 passed.uv run ruff check tests/python/— clean.uv run mypy py_src/taskito/ tests/python/ --no-incremental— clean.