pytest-asyncio
==============
.. image:: https://img.shields.io/pypi/v/pytest-asyncio.svg
:target: https://pypi.python.org/pypi/pytest-asyncio
.. image:: https://github.com/pytest-dev/pytest-asyncio/workflows/CI/badge.svg
:target: https://github.com/pytest-dev/pytest-asyncio/actions?workflow=CI
.. image:: https://codecov.io/gh/pytest-dev/pytest-asyncio/branch/main/graph/badge.svg
:target: https://codecov.io/gh/pytest-dev/pytest-asyncio
.. image:: https://img.shields.io/pypi/pyversions/pytest-asyncio.svg
:target: https://github.com/pytest-dev/pytest-asyncio
:alt: Supported Python versions
.. image:: https://img.shields.io/badge/Matrix-%23pytest--asyncio-brightgreen
:alt: Matrix chat room: #pytest-asyncio
:target: https://matrix.to/#/#pytest-asyncio:matrix.org
`pytest-asyncio <https://pytest-asyncio.readthedocs.io/en/latest/>`_ is a `pytest <https://docs.pytest.org/en/latest/contents.html>`_ plugin. It facilitates testing of code that uses the `asyncio <https://docs.python.org/3/library/asyncio.html>`_ library.
Specifically, pytest-asyncio provides support for coroutines as test functions. This allows users to *await* code inside their tests. For example, the following code is executed as a test item by pytest:
.. code-block:: python
@pytest.mark.asyncio
async def test_some_asyncio_code():
res = await library.do_something()
assert b"expected result" == res
More details can be found in the `documentation <https://pytest-asyncio.readthedocs.io/en/latest/>`_.
Note that test classes subclassing the standard `unittest <https://docs.python.org/3/library/unittest.html>`__ library are not supported. Users
are advised to use `unittest.IsolatedAsyncioTestCase <https://docs.python.org/3/library/unittest.html#unittest.IsolatedAsyncioTestCase>`__
or an async framework such as `asynctest <https://asynctest.readthedocs.io/en/latest>`__.
pytest-asyncio is available under the `Apache License 2.0 <https://github.com/pytest-dev/pytest-asyncio/blob/main/LICENSE>`_.
Installation
------------
To install pytest-asyncio, simply:
.. code-block:: bash
$ pip install pytest-asyncio
This is enough for pytest to pick up pytest-asyncio.
Contributing
------------
Contributions are very welcome. Tests can be run with ``tox``, please ensure
the coverage at least stays the same before you submit a pull request.
Raw data
{
"_id": null,
"home_page": "https://github.com/pytest-dev/pytest-asyncio",
"name": "pytest-asyncio",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Tin Tvrtkovi\u0107 <tinchester@gmail.com>",
"author_email": "tinchester@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/52/6d/c6cf50ce320cf8611df7a1254d86233b3df7cc07f9b5f5cbcb82e08aa534/pytest_asyncio-0.24.0.tar.gz",
"platform": null,
"description": "pytest-asyncio\n==============\n\n.. image:: https://img.shields.io/pypi/v/pytest-asyncio.svg\n :target: https://pypi.python.org/pypi/pytest-asyncio\n.. image:: https://github.com/pytest-dev/pytest-asyncio/workflows/CI/badge.svg\n :target: https://github.com/pytest-dev/pytest-asyncio/actions?workflow=CI\n.. image:: https://codecov.io/gh/pytest-dev/pytest-asyncio/branch/main/graph/badge.svg\n :target: https://codecov.io/gh/pytest-dev/pytest-asyncio\n.. image:: https://img.shields.io/pypi/pyversions/pytest-asyncio.svg\n :target: https://github.com/pytest-dev/pytest-asyncio\n :alt: Supported Python versions\n.. image:: https://img.shields.io/badge/Matrix-%23pytest--asyncio-brightgreen\n :alt: Matrix chat room: #pytest-asyncio\n :target: https://matrix.to/#/#pytest-asyncio:matrix.org\n\n`pytest-asyncio <https://pytest-asyncio.readthedocs.io/en/latest/>`_ is a `pytest <https://docs.pytest.org/en/latest/contents.html>`_ plugin. It facilitates testing of code that uses the `asyncio <https://docs.python.org/3/library/asyncio.html>`_ library.\n\nSpecifically, pytest-asyncio provides support for coroutines as test functions. This allows users to *await* code inside their tests. For example, the following code is executed as a test item by pytest:\n\n.. code-block:: python\n\n @pytest.mark.asyncio\n async def test_some_asyncio_code():\n res = await library.do_something()\n assert b\"expected result\" == res\n\nMore details can be found in the `documentation <https://pytest-asyncio.readthedocs.io/en/latest/>`_.\n\nNote that test classes subclassing the standard `unittest <https://docs.python.org/3/library/unittest.html>`__ library are not supported. Users\nare advised to use `unittest.IsolatedAsyncioTestCase <https://docs.python.org/3/library/unittest.html#unittest.IsolatedAsyncioTestCase>`__\nor an async framework such as `asynctest <https://asynctest.readthedocs.io/en/latest>`__.\n\n\npytest-asyncio is available under the `Apache License 2.0 <https://github.com/pytest-dev/pytest-asyncio/blob/main/LICENSE>`_.\n\n\nInstallation\n------------\n\nTo install pytest-asyncio, simply:\n\n.. code-block:: bash\n\n $ pip install pytest-asyncio\n\nThis is enough for pytest to pick up pytest-asyncio.\n\n\nContributing\n------------\nContributions are very welcome. Tests can be run with ``tox``, please ensure\nthe coverage at least stays the same before you submit a pull request.\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Pytest support for asyncio",
"version": "0.24.0",
"project_urls": {
"Bug Tracker": "https://github.com/pytest-dev/pytest-asyncio/issues",
"Changelog": "https://pytest-asyncio.readthedocs.io/en/latest/reference/changelog.html",
"Documentation": "https://pytest-asyncio.readthedocs.io",
"Homepage": "https://github.com/pytest-dev/pytest-asyncio",
"Source Code": "https://github.com/pytest-dev/pytest-asyncio"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "96316607dab48616902f76885dfcf62c08d929796fc3b2d2318faf9fd54dbed9",
"md5": "23a90579929f4fb18f604c9a61051d3e",
"sha256": "a811296ed596b69bf0b6f3dc40f83bcaf341b155a269052d82efa2b25ac7037b"
},
"downloads": -1,
"filename": "pytest_asyncio-0.24.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "23a90579929f4fb18f604c9a61051d3e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 18024,
"upload_time": "2024-08-22T08:03:15",
"upload_time_iso_8601": "2024-08-22T08:03:15.536832Z",
"url": "https://files.pythonhosted.org/packages/96/31/6607dab48616902f76885dfcf62c08d929796fc3b2d2318faf9fd54dbed9/pytest_asyncio-0.24.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "526dc6cf50ce320cf8611df7a1254d86233b3df7cc07f9b5f5cbcb82e08aa534",
"md5": "510ca6136236bba0f0581aa46060ae03",
"sha256": "d081d828e576d85f875399194281e92bf8a68d60d72d1a2faf2feddb6c46b276"
},
"downloads": -1,
"filename": "pytest_asyncio-0.24.0.tar.gz",
"has_sig": false,
"md5_digest": "510ca6136236bba0f0581aa46060ae03",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 49855,
"upload_time": "2024-08-22T08:03:18",
"upload_time_iso_8601": "2024-08-22T08:03:18.145148Z",
"url": "https://files.pythonhosted.org/packages/52/6d/c6cf50ce320cf8611df7a1254d86233b3df7cc07f9b5f5cbcb82e08aa534/pytest_asyncio-0.24.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-22 08:03:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pytest-dev",
"github_project": "pytest-asyncio",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "pytest-asyncio"
}