Problem
Three tests in tests/test_graceful_shutdown.py use SlowTaskClaimer(delay=10.0):
TestDrainTimeout.test_drain_timeout_returns_false (line 145)
TestDrainTimeout.test_drain_timeout_logs_warning (line 159)
TestNATSListenerShutdown.test_stop_called_even_when_drain_times_out (line 277)
Each creates an asyncio task that sleeps for 10 seconds, then cancels it. If the cancel+await doesn't fully suppress the dangling task in the current pytest-asyncio version (1.3.0), the event loop stays alive for up to 10s per test, totalling 30+ seconds of overhead — contributing to the CI Python Tests job exceeding its 10-minute timeout.
Recommended Fix
Replace delay=10.0 with delay=60.0 only if you want to simulate a truly unreachable timeout scenario, but use a asyncio.wait_for guard in the test itself. Or reduce to delay=5.0 and verify the cancel path works correctly.
Alternatively, install pytest-timeout and add per-test @pytest.mark.timeout(2) markers so these tests are killed quickly if they hang instead of causing the whole suite to time out.
Context
Discovered during investigation of Python Tests job hitting the 10-minute timeout-minutes gate in CI (PR #451). The primary cause was pytest.ini shadowing pyproject.toml (fixed in PR #451), but these tests remain a latent risk.
Problem
Three tests in
tests/test_graceful_shutdown.pyuseSlowTaskClaimer(delay=10.0):TestDrainTimeout.test_drain_timeout_returns_false(line 145)TestDrainTimeout.test_drain_timeout_logs_warning(line 159)TestNATSListenerShutdown.test_stop_called_even_when_drain_times_out(line 277)Each creates an asyncio task that sleeps for 10 seconds, then cancels it. If the cancel+await doesn't fully suppress the dangling task in the current pytest-asyncio version (1.3.0), the event loop stays alive for up to 10s per test, totalling 30+ seconds of overhead — contributing to the CI
Python Testsjob exceeding its 10-minute timeout.Recommended Fix
Replace
delay=10.0withdelay=60.0only if you want to simulate a truly unreachable timeout scenario, but use aasyncio.wait_forguard in the test itself. Or reduce todelay=5.0and verify the cancel path works correctly.Alternatively, install
pytest-timeoutand add per-test@pytest.mark.timeout(2)markers so these tests are killed quickly if they hang instead of causing the whole suite to time out.Context
Discovered during investigation of
Python Testsjob hitting the 10-minutetimeout-minutesgate in CI (PR #451). The primary cause waspytest.inishadowingpyproject.toml(fixed in PR #451), but these tests remain a latent risk.