| 1 |
import asyncio |
| 2 |
import warnings |
| 3 |
|
| 4 |
with warnings.catch_warnings(): |
| 5 |
warnings.simplefilter("ignore", DeprecationWarning) |
| 6 |
from asyncio import DefaultEventLoopPolicy |
| 7 |
|
| 8 |
import pytest |
| 9 |
|
| 10 |
|
| 11 |
class CustomEventLoopPolicy(DefaultEventLoopPolicy): |
| 12 |
pass |
| 13 |
|
| 14 |
|
| 15 |
@pytest.fixture( |
| 16 |
scope="session", |
| 17 |
params=( |
| 18 |
CustomEventLoopPolicy(), |
| 19 |
CustomEventLoopPolicy(), |
| 20 |
), |
| 21 |
) |
| 22 |
def event_loop_policy(request): |
| 23 |
return request.param |
| 24 |
|
| 25 |
|
| 26 |
@pytest.mark.asyncio |
| 27 |
@pytest.mark.filterwarnings("ignore::DeprecationWarning") |
| 28 |
async def test_uses_custom_event_loop_policy(): |
| 29 |
assert isinstance(asyncio.get_event_loop_policy(), CustomEventLoopPolicy) |