Skip to content

0.14 overrides event loop choice and breaks tests #188

Closed
@bryevdv

Description

@bryevdv

Bokeh relies on Tornado which is incompatible with the default Proactor event loop on Windows starting with Python 3.8.

Accordingly, we call this function

def fixup_windows_event_loop_policy() -> None:
    if sys.platform == 'win32' and sys.version_info[:3] >= (3, 8, 0):
        import asyncio
        if type(asyncio.get_event_loop_policy()) is asyncio.WindowsProactorEventLoopPolicy:
            # WindowsProactorEventLoopPolicy is not compatible with tornado 6
            # fallback to the pre-3.8 default of WindowsSelectorEventLoopPolicy
            asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

in any module that will need to use tornado. Since 0.14 became available, all our Tornado tests are failing, because the Proactor loop is being used in tests even despite our explicit event loop policy selection:


509
self = <ProactorEventLoop running=False closed=False debug=False>, fd = 2832
510
callback = <bound method BaseAsyncIOLoop._handle_events of <tornado.platform.asyncio.AsyncIOMainLoop object at 0x0000020E9CBDCB50>>
511
args = (2832, 1)

Is this intentional? is there some new way we should configure pytest-asyncio to be able to not override our policy selection?

ref: bokeh/bokeh#10514

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions