pytest-asyncio


Namepytest-asyncio JSON
Version 0.25.1 PyPI version JSON
download
home_pageNone
SummaryPytest support for asyncio
upload_time2025-01-02 05:06:32
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseApache 2.0
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": null,
    "keywords": null,
    "author": null,
    "author_email": "\"Tin Tvrtkovi\u0107 <tinchester@gmail.com>\" <tinchester@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/4b/04/0477a4bdd176ad678d148c075f43620b3f7a060ff61c7da48500b1fa8a75/pytest_asyncio-0.25.1.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.25.1",
    "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": "81fbefc7226b384befd98d0e00d8c4390ad57f33c8fde00094b85c5e07897def",
                "md5": "49f421a39c56222ac8aa54bc0803e891",
                "sha256": "c84878849ec63ff2ca509423616e071ef9cd8cc93c053aa33b5b8fb70a990671"
            },
            "downloads": -1,
            "filename": "pytest_asyncio-0.25.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "49f421a39c56222ac8aa54bc0803e891",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 19357,
            "upload_time": "2025-01-02T05:06:30",
            "upload_time_iso_8601": "2025-01-02T05:06:30.933873Z",
            "url": "https://files.pythonhosted.org/packages/81/fb/efc7226b384befd98d0e00d8c4390ad57f33c8fde00094b85c5e07897def/pytest_asyncio-0.25.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4b040477a4bdd176ad678d148c075f43620b3f7a060ff61c7da48500b1fa8a75",
                "md5": "0ea47ff8ca3384944a4b4262e1628f99",
                "sha256": "79be8a72384b0c917677e00daa711e07db15259f4d23203c59012bcd989d4aee"
            },
            "downloads": -1,
            "filename": "pytest_asyncio-0.25.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0ea47ff8ca3384944a4b4262e1628f99",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 53760,
            "upload_time": "2025-01-02T05:06:32",
            "upload_time_iso_8601": "2025-01-02T05:06:32.678753Z",
            "url": "https://files.pythonhosted.org/packages/4b/04/0477a4bdd176ad678d148c075f43620b3f7a060ff61c7da48500b1fa8a75/pytest_asyncio-0.25.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-02 05:06:32",
    "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: 0.40684s