Registry / testing / pytest-async

pytest-async

JSON →
library0.1.1pypypi✓ verified 87d ago

pytest-async is a lightweight Pytest plugin for testing async functions. It automatically runs coroutines in an event loop without requiring decorators like @pytest.mark.asyncio. Current version 0.1.1 targets Python >=3.6. It is in maintenance mode with limited updates.

pip install pytest-async==0.1.1
INSTALL
IMPORT
SIG · PYTEST-ASYNC
P
pytest-async
testingpythonv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_async
import pytest_async
The plugin is automatically loaded by Pytest; explicit import only needed for configuration.

Define async test functions directly; no decorator needed. Pytest automatically runs them in an event loop.

# test_async.py async def test_async_func(): assert await some_async_call() async def some_async_call(): return 42
Debug
Known issues
gotchapytest-async automatically runs ALL coroutines in tests, including fixtures. Avoid defining async fixtures that are not meant to be tests, as they may be executed inadvertently.
fix
Use synchronous fixtures or mark non-test async functions with @pytest.fixture but note that pytest-async may still attempt to run them. Consider using pytest-asyncio for more control.
affects: >=0.1.0
deprecatedpytest-async is no longer actively maintained. The recommended alternative is pytest-asyncio, which is actively developed and supports Python 3.7+.
fix
Migrate to pytest-asyncio: install pytest-asyncio, remove pytest-async, and add @pytest.mark.asyncio decorator to async tests.
affects: >=0.1.0
Errors
Common errors & fixes
DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
pytest-async 0.1.1 uses deprecated collections imports not compatible with Python 3.9+.
fix
Upgrade to Python 3.8 or lower, or switch to pytest-asyncio.
TypeError: object NoneType can't be used in 'await' expression
Test function is not properly awaited; possible mixing with synchronous test runner.
fix
Ensure test function is defined with 'async def' and that pytest-async is installed correctly. If using pytest-asyncio, add @pytest.mark.asyncio.
Upgrade
Version history
0.1.1latest on PyPI · released Feb 26, 2020
Audit
Dependencies
pytestrequiredRequired as a test framework plugin.
Agent activity
4 hits · last 30 days
node
4
Resources
pytest-async — pip install pytest-async · libregistry