5
5
6
6
7
7
@pytest .mark .asyncio
8
- async def test_module_with_event_loop_finalizer (port1 ):
8
+ async def test_module_with_event_loop_finalizer (port_with_event_loop_finalizer ):
9
9
await asyncio .sleep (0.01 )
10
- assert port1
10
+ assert port_with_event_loop_finalizer
11
11
12
12
@pytest .mark .asyncio
13
- async def test_module_with_get_event_loop_finalizer (port2 ):
13
+ async def test_module_with_get_event_loop_finalizer (port_with_get_event_loop_finalizer ):
14
14
await asyncio .sleep (0.01 )
15
- assert port2
15
+ assert port_with_get_event_loop_finalizer
16
16
17
17
@pytest .fixture (scope = "module" )
18
18
def event_loop ():
@@ -24,11 +24,11 @@ def event_loop():
24
24
25
25
26
26
@pytest .fixture (scope = "module" )
27
- async def port1 (request , event_loop ):
27
+ async def port_with_event_loop_finalizer (request , event_loop ):
28
28
def port_finalizer (finalizer ):
29
29
async def port_afinalizer ():
30
- # await task inside get_event_loop()
31
- # RantimeError is raised if task is created on a different loop
30
+ # await task using loop provided by event_loop fixture
31
+ # RuntimeError is raised if task is created on a different loop
32
32
await finalizer
33
33
event_loop .run_until_complete (port_afinalizer ())
34
34
@@ -38,11 +38,11 @@ async def port_afinalizer():
38
38
39
39
40
40
@pytest .fixture (scope = "module" )
41
- async def port2 (request , event_loop ):
41
+ async def port_with_get_event_loop_finalizer (request , event_loop ):
42
42
def port_finalizer (finalizer ):
43
43
async def port_afinalizer ():
44
- # await task inside get_event_loop()
45
- # if loop is different a RuntimeError is raised
44
+ # await task using loop provided by asyncio. get_event_loop()
45
+ # RuntimeError is raised if task is created on a different loop
46
46
await finalizer
47
47
asyncio .get_event_loop ().run_until_complete (port_afinalizer ())
48
48
0 commit comments