Skip to content

Commit 2064a48

Browse files
committed
Set asyncio WindowsSelectorEventLoopPolicy on Windows
1 parent 18e7317 commit 2064a48

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/conftest.py

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import asyncio
12
import logging
3+
import os
24
from math import inf
35
from threading import Event
46
from typing import Any, Callable, no_type_check
@@ -40,6 +42,11 @@
4042
resource.setrlimit(resource.RLIMIT_NOFILE, (soft, hard))
4143

4244

45+
# Enforce selector event loop on Windows.
46+
if os.name == "nt":
47+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # type:ignore
48+
49+
4350
class TestSession(Session):
4451
"""A session that copies sent messages to an internal stream, so that
4552
they can be accessed later.

0 commit comments

Comments
 (0)