Skip to content

Commit c7d19f6

Browse files
committed
Move event loop policy to dedicated fixture
1 parent 155079b commit c7d19f6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/conftest.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ def pytest_addoption(parser) -> None:
2020

2121
@pytest.fixture
2222
async def display(backend, browser):
23-
if sys.platform == "win32":
24-
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
2523
async with DisplayFixture(backend, browser) as display_fixture:
2624
display_fixture.page.set_default_timeout(10000)
2725
yield display_fixture
@@ -37,3 +35,10 @@ async def backend():
3735
async def browser(pytestconfig):
3836
async with async_playwright() as pw:
3937
yield await pw.chromium.launch(headless=True if GITHUB_ACTIONS else pytestconfig.getoption("headless"))
38+
39+
40+
@pytest.fixture
41+
def event_loop_policy(request):
42+
if sys.platform == "win32":
43+
return asyncio.WindowsProactorEventLoopPolicy()
44+
return asyncio.get_event_loop_policy()

0 commit comments

Comments
 (0)