Skip to content

Commit

Permalink
Set asyncio WindowsSelectorEventLoopPolicy on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Nov 19, 2024
1 parent 18e7317 commit 2064a48
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import asyncio
import logging
import os
from math import inf
from threading import Event
from typing import Any, Callable, no_type_check
Expand Down Expand Up @@ -40,6 +42,11 @@
resource.setrlimit(resource.RLIMIT_NOFILE, (soft, hard))


# Enforce selector event loop on Windows.
if os.name == "nt":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # type:ignore


class TestSession(Session):
"""A session that copies sent messages to an internal stream, so that
they can be accessed later.
Expand Down

0 comments on commit 2064a48

Please sign in to comment.