Skip to content

fix: resolve Python 3.11 test hang + add CI safety nets#13

Merged
Oceanswave merged 2 commits intomainfrom
fix/py311-test-hang
Feb 4, 2026
Merged

fix: resolve Python 3.11 test hang + add CI safety nets#13
Oceanswave merged 2 commits intomainfrom
fix/py311-test-hang

Conversation

@Oceanswave
Copy link
Owner

@Oceanswave Oceanswave commented Feb 4, 2026

Summary

  • Fix test_queue_overflow_drops_silently deadlock on Python 3.11 — removed unnecessary app.run_test() wrapper that triggered Textual ContextVar + event loop conflicts
  • Add pytest-timeout (30s/test) to catch future hangs
  • Add 10-minute CI job timeout to prevent multi-hour runs
  • Enable verbose pytest output in CI for diagnostics

Root cause: Textual's ContextVar.reset() raises ValueError on Python 3.11 when tokens are created in a different async context. Combined with the tight 110-frame push_frame loop and background workers inside run_test(), this caused a deadlock. The test only validates queue overflow behavior and doesn't need the full Textual lifecycle.

Test plan

  • All 1691 tests pass locally with timeout
  • ruff + mypy clean
  • CI: All three Python versions (3.11, 3.12, 3.13) pass

🤖 Generated with Claude Code

Oceanswave and others added 2 commits February 3, 2026 19:51
Python 3.11 CI jobs hang indefinitely during pytest while 3.12/3.13
complete in ~80 seconds. Add:
- pytest-timeout (30s per test) to identify which test hangs
- 10-minute job timeout to prevent multi-hour CI runs
- Verbose pytest output in CI for better diagnostics

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The test_queue_overflow_drops_silently test deadlocks on Python 3.11
because Textual's ContextVar handling + asyncio event loop scheduling
differs from 3.12+. The test only validates that push_frame silently
drops frames when the queue is full — it doesn't need the full Textual
app lifecycle. Remove app.run_test() wrapper to fix the 3.11 hang.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Oceanswave Oceanswave changed the title ci: add pytest-timeout to diagnose Python 3.11 hang fix: resolve Python 3.11 test hang + add CI safety nets Feb 4, 2026
@Oceanswave Oceanswave merged commit 5e24f41 into main Feb 4, 2026
3 checks passed
@Oceanswave Oceanswave deleted the fix/py311-test-hang branch February 4, 2026 01:19
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