Skip to content

Commit

Permalink
Workaround for Python 3.7 on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney authored and tombh committed May 30, 2023
1 parent 350fc6a commit d764e1f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
############################################################################
import asyncio
import pathlib
import sys

import pytest

from pygls import uris, IS_PYODIDE
from pygls import uris, IS_PYODIDE, IS_WIN
from pygls.feature_manager import FeatureManager
from pygls.workspace import Document, Workspace

Expand Down Expand Up @@ -80,7 +81,13 @@ def workspace_dir():
def event_loop():
"""Redefine `pytest-asyncio's default event_loop fixture to match the scope
of our client fixture."""
policy = asyncio.get_event_loop_policy()

# Only required for Python 3.7 on Windows.
if sys.version_info.minor == 7 and IS_WIN:
policy = asyncio.WindowsProactorEventLoopPolicy()
else:
policy = asyncio.get_event_loop_policy()

loop = policy.new_event_loop()
yield loop

Expand Down

0 comments on commit d764e1f

Please sign in to comment.