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
Hashes for pytest-asyncio-cooperative-0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2bcd53bb6281aa8464e774530ac0f9842d94764642367d72c1264cb4da46846 |
|
MD5 | f3eb52b9189ef27bc64ec8e370168666 |
|
BLAKE2b-256 | 4e7a04fd8d8d0d70190db484cbfd3dea1796d7924f9435b93931f7bea37dd7ad |
Hashes for pytest_asyncio_cooperative-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e831abde4067513233aa8f0e117a7b81e492da676f7265de13289bce264d464 |
|
MD5 | 42323e52edbf27b11f3760ee1da54ee9 |
|
BLAKE2b-256 | 6f7fe994ce3a57f2170a654935c28fcc409cd9ba5acb95e9c271eb1f2c602a0e |