1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
from __future__ import annotations
import asyncio
import pytest
@pytest.fixture()
async def async_inner_fixture():
await asyncio.sleep(0.01)
print("inner start")
yield True
print("inner stop")
@pytest.fixture()
async def async_fixture_outer(async_inner_fixture):
await asyncio.sleep(0.01)
print("outer start")
assert async_inner_fixture is True
yield True
print("outer stop")
@pytest.mark.asyncio
async def test_async_fixture(async_fixture_outer):
assert async_fixture_outer is True
print("test_async_fixture")
|