test(desktop): run the serve loop-factory regression on the Windows lane
A bare skipif never ran anywhere: the Windows job selects -m windows_only. Use the marker, drop the issue number from the filename, and let an old uvicorn without get_loop_factory fall through to _run_serve's existing selector-policy fallback instead of a second try/except.
This commit is contained in:
@@ -1397,15 +1397,11 @@ def _windows_serve_loop_factory(config):
|
||||
uvicorn 0.41's ``asyncio_loop_factory`` returns ProactorEventLoop on
|
||||
win32, on which uvicorn's socket stack binds-but-never-accepts (READY
|
||||
prints, then WinError 10014 accept failures, exit 1, desktop
|
||||
ECONNREFUSED — #120164, regression of #50641). Force the selector loop
|
||||
uvicorn served on before; a factory that already yields selector loops
|
||||
(older uvicorn, explicit ``--loop``) passes through untouched.
|
||||
ECONNREFUSED — #120164, regression of #50641). A factory that already
|
||||
yields selector loops (older uvicorn, explicit ``--loop``) passes through.
|
||||
"""
|
||||
try:
|
||||
factory = config.get_loop_factory()
|
||||
except Exception:
|
||||
return asyncio.SelectorEventLoop
|
||||
if factory is None or getattr(factory, "__name__", "") == "ProactorEventLoop":
|
||||
factory = config.get_loop_factory()
|
||||
if factory is None or factory is asyncio.ProactorEventLoop: # type: ignore[attr-defined]
|
||||
return asyncio.SelectorEventLoop
|
||||
return factory
|
||||
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
"""#120164 — Windows serve must run uvicorn on a SelectorEventLoop.
|
||||
"""Windows serve must run uvicorn on a SelectorEventLoop.
|
||||
|
||||
uvicorn 0.41's ``asyncio_loop_factory`` returns ProactorEventLoop on win32.
|
||||
Driving uvicorn's socket stack on the proactor loop binds-but-never-accepts:
|
||||
READY prints, then ``Accept failed on a socket`` + WinError 10014, exit 1,
|
||||
desktop ECONNREFUSED (regression of #50641, whose fix trusted
|
||||
``config.get_loop_factory()`` back when that still meant selector on Windows).
|
||||
Regression for #120164. uvicorn 0.41's ``asyncio_loop_factory`` returns
|
||||
ProactorEventLoop on win32. Driving uvicorn's socket stack on the proactor loop
|
||||
binds-but-never-accepts: READY prints, then ``Accept failed on a socket`` +
|
||||
WinError 10014, exit 1, desktop ECONNREFUSED (regression of #50641, whose fix
|
||||
trusted ``config.get_loop_factory()`` back when that still meant selector).
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
sys.platform != "win32", reason="Windows serve-runner path under test"
|
||||
)
|
||||
pytestmark = pytest.mark.windows_only
|
||||
|
||||
|
||||
class _ProactorConfig:
|
||||
Reference in New Issue
Block a user