File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change
1
+ :func: `asyncio.get_running_loop() ` will now return the trio-asyncio event loop
2
+ (if running), instead of failing with :exc: `RuntimeError `.
Original file line number Diff line number Diff line change @@ -36,3 +36,14 @@ async def test_half_fixtured_asyncpg_conn(asyncio_fixture_own_loop):
36
36
@pytest .mark .trio
37
37
async def test_fixtured_asyncpg_conn (asyncio_fixture_with_fixtured_loop ):
38
38
await use_asyncio ()
39
+
40
+
41
+ @pytest .mark .trio
42
+ async def test_get_running_loop ():
43
+ async with trio_asyncio .open_loop () as loop :
44
+ try :
45
+ from asyncio import get_running_loop
46
+ except ImportError :
47
+ pass # Python 3.6
48
+ else :
49
+ assert get_running_loop () == loop
Original file line number Diff line number Diff line change @@ -251,6 +251,8 @@ def _new_run_get_or_throw():
251
251
252
252
_aio_event ._get_running_loop = _new_run_get
253
253
_aio_event .get_running_loop = _new_run_get_or_throw
254
+ asyncio ._get_running_loop = _new_run_get
255
+ asyncio .get_running_loop = _new_run_get_or_throw
254
256
255
257
#####
256
258
You can’t perform that action at this time.
0 commit comments