File: concepts_concurrent_execution_example.py

package info (click to toggle)
python-pytest-asyncio 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 644 kB
  • sloc: python: 3,003; makefile: 24; sh: 1
file content (16 lines) | stat: -rw-r--r-- 270 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import asyncio

import pytest


@pytest.mark.asyncio
async def test_first():
    await asyncio.sleep(2)  # Takes 2 seconds


@pytest.mark.asyncio
async def test_second():
    await asyncio.sleep(2)  # Takes 2 seconds


# Total execution time: ~4 seconds, not ~2 seconds