File: test_nested.py

package info (click to toggle)
python-pytest-asyncio 0.25.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 656 kB
  • sloc: python: 3,108; makefile: 26; sh: 1
file content (28 lines) | stat: -rw-r--r-- 563 bytes parent folder | download
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")