pytest-asyncio


Namepytest-asyncio JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryPytest support for asyncio
upload_time2025-07-16 04:29:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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": null,
    "name": "pytest-asyncio",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Michael Seifert <m.seifert@digitalernachschub.de>",
    "keywords": null,
    "author": null,
    "author_email": "Tin Tvrtkovi\u0107 <tinchester@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/4e/51/f8794af39eeb870e87a8c8068642fc07bce0c854d6865d7dd0f2a9d338c2/pytest_asyncio-1.1.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": null,
    "summary": "Pytest support for asyncio",
    "version": "1.1.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": null,
            "digests": {
                "blake2b_256": "c79dbf86eddabf8c6c9cb1ea9a869d6873b46f105a5d292d3a6f7071f5b07935",
                "md5": "5f0a021125ff1ee7c69f650eb60a7705",
                "sha256": "5fe2d69607b0bd75c656d1211f969cadba035030156745ee09e7d71740e58ecf"
            },
            "downloads": -1,
            "filename": "pytest_asyncio-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5f0a021125ff1ee7c69f650eb60a7705",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 15157,
            "upload_time": "2025-07-16T04:29:24",
            "upload_time_iso_8601": "2025-07-16T04:29:24.929638Z",
            "url": "https://files.pythonhosted.org/packages/c7/9d/bf86eddabf8c6c9cb1ea9a869d6873b46f105a5d292d3a6f7071f5b07935/pytest_asyncio-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4e51f8794af39eeb870e87a8c8068642fc07bce0c854d6865d7dd0f2a9d338c2",
                "md5": "ff6ae26dc96e33ff84431b397ad45949",
                "sha256": "796aa822981e01b68c12e4827b8697108f7205020f24b5793b3c41555dab68ea"
            },
            "downloads": -1,
            "filename": "pytest_asyncio-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ff6ae26dc96e33ff84431b397ad45949",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 46652,
            "upload_time": "2025-07-16T04:29:26",
            "upload_time_iso_8601": "2025-07-16T04:29:26.393124Z",
            "url": "https://files.pythonhosted.org/packages/4e/51/f8794af39eeb870e87a8c8068642fc07bce0c854d6865d7dd0f2a9d338c2/pytest_asyncio-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-16 04:29:26",
    "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"
}
        
Elapsed time: 1.34385s