Run all your asynchronous tests cooperatively.
Project description
Use asyncio (cooperative multitasking) to run your I/O bound test suite efficiently and quickly.
import asyncio
import pytest
@pytest.mark.asyncio_cooperative
async def test_a():
await asyncio.sleep(2)
@pytest.mark.asyncio_cooperative
async def test_b():
await asyncio.sleep(2)
========== 2 passed in 2.05 seconds ==========
Quickstart
pip install pytest-asyncio-cooperative
Goals
Reduce the total run time of I/O bound test suites via cooperative multitasking
Reduce system resource usage via cooperative multitasking
Pros
An I/O bound test suite will run faster (ie. individual tests will take just as long. The total runtime of the entire test suite will be faster)
An I/O bound test suite will use less system resources (ie. only a single thread is used)
Cons
All tests MUST be coroutines (ie. have the async keyword)
Order of tests is not guaranteed (ie. some blocking operations might taken longer and affect the order of test results)
Tests MUST be isolated from each other (ie. NO shared resources, NO mock.patch)
There is NO parallelism, CPU bound tests will NOT get a performance benefit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest-asyncio-cooperative-0.3.0.tar.gz.
File metadata
- Download URL: pytest-asyncio-cooperative-0.3.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4570e4342bbd30f83e55093f9fb51db2dfcbf00dc0b3e00797b8a489bc44ba12
|
|
| MD5 |
f87c04c8bb97de15615639674bf59579
|
|
| BLAKE2b-256 |
a5206615c759711620a027706da58f29f8f803a778ad1a4f5ee99c2511a7ad7e
|
File details
Details for the file pytest_asyncio_cooperative-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pytest_asyncio_cooperative-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd5fbbf76e4e3faca54ac28ce696ce55af400a3fdc89155294d3adea3c9f03cb
|
|
| MD5 |
c229a5bb05645fdcc0c8c84dbc6e99e5
|
|
| BLAKE2b-256 |
5d3df20a9cdf5048e33c22ff498fc314792f0860a1ad55f3cf69aad2e27a3746
|