Skip to content

Commit

Permalink
set event loop policy for windows (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorshea authored Oct 18, 2022
1 parent 688a16d commit 50e42c0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import asyncio
import os

import pytest
Expand Down Expand Up @@ -50,14 +51,14 @@ async def page(browser):

@pytest.fixture(scope="session")
async def browser(pytestconfig: Config):
if os.name == "nt": # pragma: no cover
pytest.skip("Browser tests not supported on Windows")
async with async_playwright() as pw:
yield await pw.chromium.launch(headless=not bool(pytestconfig.option.headed))


@pytest.fixture(scope="session")
def event_loop():
if os.name == "nt": # pragma: no cover
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
with open_event_loop() as loop:
yield loop

Expand Down

0 comments on commit 50e42c0

Please sign in to comment.