Debian Codegraph @

docs/reference/markers/module_scoped_loop_strict_mode_example.py

raw
1 import asyncio
2
3 import pytest
4
5 pytestmark = pytest.mark.asyncio(loop_scope="module")
6
7 loop: asyncio.AbstractEventLoop
8
9
10 async def test_remember_loop():
11 global loop
12 loop = asyncio.get_running_loop()
13
14
15 async def test_this_runs_in_same_loop():
16 global loop
17 assert asyncio.get_running_loop() is loop
18
19
20 class TestClassA:
21 async def test_this_runs_in_same_loop(self):
22 global loop
23 assert asyncio.get_running_loop() is loop