Skip to content

[Bug]: Playwright + AnyIO Loop Conflict on Windows #3037

@HDembinski

Description

@HDembinski

Version

1.58.0

Steps to reproduce

Expected behavior

Playwright sync tests and AnyIO async tests should be runnable in the same pytest session, independent of test order.

Actual behavior

After a Playwright sync test, AnyIO async tests may fail to create/close their own runner with loop-state errors.

Additional context

  • A local workaround that force-clears asyncio internals (asyncio.events._set_running_loop(None)) was attempted but didn't work, because it breaks Playwright teardown (Browser.close: no running event loop).

Environment

- OS: Windows 11 (10.0.22631)
- Python: 3.12.6
- pytest: 9.0.2
- anyio: 4.12.1
- playwright: 1.58.0
- pytest-playwright: 0.7.2

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