Debian Codegraph @

docs/how-to-guides/configure_loop_factories_per_test/conftest.py

raw
1 import asyncio
2
3 import pytest
4
5
6 class CustomEventLoop(asyncio.SelectorEventLoop):
7 pass
8
9
10 @pytest.fixture
11 def requires_custom_loop():
12 pass
13
14
15 def pytest_asyncio_loop_factories(config, item):
16 if "requires_custom_loop" in item.fixturenames:
17 return {"custom": CustomEventLoop}
18 return {"default": asyncio.new_event_loop}