File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import asyncio
22import os
3+ from unittest .mock import ANY
34
45import pytest
56
67import qasync
78
89@pytest .fixture
910def get_event_loop_coro (expected_loop ):
10- async def coro ():
11+ async def coro (expected_debug ):
1112 event_loop = asyncio .get_event_loop ()
1213
1314 assert type (event_loop ).__name__ == expected_loop
15+ assert event_loop .get_debug () == expected_debug
1416 await asyncio .sleep (0 )
1517 return coro
1618
@@ -20,13 +22,17 @@ def expected_loop():
2022
2123def test_run_with_contextmanager (get_event_loop_coro ):
2224 asyncio .set_event_loop (None )
23- qasync .run (get_event_loop_coro ())
25+ qasync .run (get_event_loop_coro (ANY ))
2426
2527 with pytest .raises (RuntimeError ):
2628 _ = asyncio .get_event_loop ()
2729
28- def test_run_reset_policy (get_event_loop_coro , expected_loop ):
30+ def test_run_reset_policy (get_event_loop_coro ):
2931 old_loop = asyncio .new_event_loop ()
30- qasync .run (get_event_loop_coro ())
32+ qasync .run (get_event_loop_coro (ANY ))
3133 new_loop = asyncio .new_event_loop ()
3234 assert type (old_loop ) == type (new_loop )
35+
36+ def test_run_debug (get_event_loop_coro ):
37+ qasync .run (get_event_loop_coro (True ), debug = True )
38+ qasync .run (get_event_loop_coro (False ), debug = False )
You can’t perform that action at this time.
0 commit comments