1import asyncio 2import pytest 3 4 5x = 1 6 7 8@pytest.fixture() 9def f1(): 10 global x 11 x = 2 12 yield 15 13 x = 3 14 15 16@pytest.mark.asyncio 17async def test_1(): 18 assert x == 1 19 20 21@pytest.mark.asyncio 22async def test_2(f1): 23 assert x == 2 24 assert f1 == 15 25 26 27@pytest.mark.asyncio 28async def test_3(): 29 assert x == 3 30 await asyncio.sleep(0.1) 31 assert x == 3 32