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
fix: handle Python 3.12+ get_event_loop RuntimeError in VirtualKernelContext (#1156)
* fix: handle Python 3.12+ asyncio.get_event_loop RuntimeError in VirtualKernelContext
On Python 3.12+, asyncio.run() calls set_event_loop(None) in cleanup, which puts
the policy into a state where a subsequent asyncio.get_event_loop() raises
RuntimeError instead of implicitly creating a new loop.
The VirtualKernelContext.event_loop field used asyncio.get_event_loop as its
default_factory, so any test running after a test that used asyncio.run() (e.g.
starlette_lifespan_test) failed in the autouse kernel_context fixture that
constructs a VirtualKernelContext.
Wrap the factory to create and set a new loop when get_event_loop() raises.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* ci: cap unit-test job at 15min and add pytest --session-timeout + -v
Windows unit-test jobs were hanging for hours after pytest finished
successfully — the shell step never received "process completed" because
a lingering thread/process kept Python alive. Without a job timeout, the
runner waits the full default (6h).
- timeout-minutes: 15 on the unit-test job so a hang fails fast instead
of sitting for hours.
- --session-timeout=600 makes pytest-timeout abort the whole session and
dump a stack trace before the job timeout fires, so we see what hung.
- -v prints test names as they run, so the last test before a hang is
visible in the log.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: force-exit pytest on Windows CI to bypass thread cleanup hang
On Windows CI the Python process hangs for hours after pytest prints
its passing summary, because non-daemon threads from ipykernel/websockets
keep the interpreter alive. Force-exit in pytest_sessionfinish so the
shell step completes with pytest's exit code.
Gated on CI=true so local runs still cleanup normally.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: loosen cancellation-latency assertion in lifecycle test
The 0.001s bound was too tight for CI runners — observed delta of
0.0016s on mac 3.8 CI. 0.05s still clearly distinguishes "cancelled
immediately" from "waited out the ~0.05s remaining cull window".
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* ci: bump pyupgrade to v3.21.2 for Python 3.14 compatibility
pre-commit.ci runs hooks under Python 3.14 and pyupgrade v3.20.0 crashes
with "TypeError: cannot use a bytes pattern on a string-like object" due
to a CPython 3.14 stdlib change. Fixed in pyupgrade v3.21.1
(asottile/pyupgrade#1040).
v3.21.2 dropped Python 3.9 support, so pin language_version so pre-commit
sets up the hook env with a compatible interpreter.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments