Skip to content

test: consume heartbeat wait coroutines#114

Merged
cgfixit merged 1 commit into
mainfrom
codex/test-monitor-heartbeat-awaitables
Jul 13, 2026
Merged

test: consume heartbeat wait coroutines#114
cgfixit merged 1 commit into
mainfrom
codex/test-monitor-heartbeat-awaitables

Conversation

@cgfixit

@cgfixit cgfixit commented Jul 13, 2026

Copy link
Copy Markdown
Owner

What

  • Replace three global asyncio.wait_for test stubs with per-event Event.wait stubs.
  • Exercise the production heartbeat's real timeout wrapper.
  • Eliminate leaked coroutine warnings from the WebSocket heartbeat tests.

Why

The tests passed while leaving each Event.wait() coroutine unconsumed. On origin/main, the focused run reported 3 passed with 5 RuntimeWarning: coroutine 'Event.wait' was never awaited warnings. Promoting those warnings to errors exposed the test defect.

This is tests-only. Production code, trading behavior, configuration, and dependencies are unchanged.

Validation

  • Baseline on origin/main: focused heartbeat run -> 3 passed, 5 RuntimeWarnings
  • python -m pytest tests/test_monitor.py::TestTradeMonitor::test_ws_heartbeat_sends_polymarket_ping tests/test_monitor.py::TestTradeMonitor::test_ws_heartbeat_subscription_wake_does_not_ping tests/test_monitor.py::TestMonitorRunAndSubscriptionRefresh::test_ws_heartbeat_pushes_subscription_update -q -W error::RuntimeWarning -> 3 passed
  • python -m pytest tests/test_monitor.py -q -W error::RuntimeWarning -> 54 passed
  • python -m pytest -v -m "not integration" -> 624 passed
  • powershell -File scripts/check-lint.ps1 -> Ruff lint and format passed
  • python -m mypy polymarket_copier --ignore-missing-imports --no-strict-optional -> success
  • git diff --check -> clean

Risk To Monitor

Low. The change only narrows test mocking from the global scheduler helper to the heartbeat's event wait method. CI timing and production runtime behavior are unaffected.

@cgfixit
cgfixit marked this pull request as ready for review July 13, 2026 02:13
@cgfixit
cgfixit merged commit 38c2639 into main Jul 13, 2026
7 checks passed
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.

1 participant