File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
1
import asyncio
2
2
import os
3
+ from unittest .mock import ANY
3
4
4
5
import pytest
5
6
6
7
import qasync
7
8
8
9
@pytest .fixture
9
10
def get_event_loop_coro (expected_loop ):
10
- async def coro ():
11
+ async def coro (expected_debug ):
11
12
event_loop = asyncio .get_event_loop ()
12
13
13
14
assert type (event_loop ).__name__ == expected_loop
15
+ assert event_loop .get_debug () == expected_debug
14
16
await asyncio .sleep (0 )
15
17
return coro
16
18
@@ -20,13 +22,17 @@ def expected_loop():
20
22
21
23
def test_run_with_contextmanager (get_event_loop_coro ):
22
24
asyncio .set_event_loop (None )
23
- qasync .run (get_event_loop_coro ())
25
+ qasync .run (get_event_loop_coro (ANY ))
24
26
25
27
with pytest .raises (RuntimeError ):
26
28
_ = asyncio .get_event_loop ()
27
29
28
- def test_run_reset_policy (get_event_loop_coro , expected_loop ):
30
+ def test_run_reset_policy (get_event_loop_coro ):
29
31
old_loop = asyncio .new_event_loop ()
30
- qasync .run (get_event_loop_coro ())
32
+ qasync .run (get_event_loop_coro (ANY ))
31
33
new_loop = asyncio .new_event_loop ()
32
34
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