You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: scheduler async dispatch poll-timeout test hangs event loop #415
tests/scheduler_tests/test_async_dispatch.py::TestDBPolling::test_poll_timeout_raises_exception hits pytest-timeout's 60s cap instead of raising Polling deadline exceeded as expected.
Details
The test calls service._poll_execution_completion(execution_id, timeout_seconds=0) expecting the polling loop to exit immediately with a deadline-exceeded exception. Instead it blocks until the outer pytest-timeout fires:
Failed: Timeout (>60.0s) from pytest-timeout.
Test location: tests/scheduler_tests/test_async_dispatch.py:258
Likely cause
The _poll_execution_completion loop reads config.poll_interval which is patched to 0.01s via patch("scheduler.service.config"). The test creates a running execution that never completes. With timeout_seconds=0, the internal deadline check should trigger on the first iteration — but something (possibly a 60s grace buffer in the deadline math, or the patched config not being read where expected) lets the loop run forever.
Fix direction
Verify scheduler.service.config is the correct patch target — the service may import poll_interval at module load (in which case the patch is a no-op).
Verify the deadline comparison uses >= not > so timeout_seconds=0 terminates immediately.
Consider adding an explicit asyncio.wait_for around the poll call inside the test, with pytest.raises asserting the inner exception.
Impact
Suite-level: blocks the scheduler test batch for the full 60s pytest-timeout window on every run.
Feature-level: none. Production code likely uses timeout_seconds>0 so this failure mode is test-only, but the test no longer validates the timeout path.
Repro
cd tests &&source .venv/bin/activate
python -m pytest scheduler_tests/test_async_dispatch.py::TestDBPolling::test_poll_timeout_raises_exception -v
Activity
test: stabilize full suite — skip archived PE tests, split unit runs,…
fix(scheduler): unhang poll-timeout test via configurable grace buffer (