{ "info": { "author": "Ralf Schmitt, Kyle Altendorf, Victor Titor", "author_email": "ralf@brainbot.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Testing" ], "description": ".. -*- mode: rst; coding: utf-8 -*-\n\n==============================================================================\npytest-twisted - test twisted code with pytest\n==============================================================================\n\n|PyPI| |Pythons| |Travis| |AppVeyor| |Black|\n\n:Authors: Ralf Schmitt, Kyle Altendorf, Victor Titor\n:Version: 1.12\n:Date: 2019-09-26\n:Download: https://pypi.python.org/pypi/pytest-twisted#downloads\n:Code: https://github.com/pytest-dev/pytest-twisted\n\n\npytest-twisted is a plugin for pytest, which allows to test code,\nwhich uses the twisted framework. test functions can return Deferred\nobjects and pytest will wait for their completion with this plugin.\n\n\nPython 2 support plans\n======================\n\nAt some point it may become impractical to retain Python 2 support.\nGiven the small size and very low amount of development it seems\nlikely that this will not be a near term issue. While I personally\nhave no need for Python 2 support I try to err on the side of being\nhelpful so support will not be explicitly removed just to not have to\nthink about it. If major issues are reported and neither myself nor\nthe community have time to resolve them then options will be\nconsidered.\n\n\nInstallation\n============\nInstall the plugin as below.\n\n.. code-block:: sh\n\n pip install pytest-twisted\n\n\nUsing the plugin\n================\n\nThe plugin is available after installation and can be disabled using\n``-p no:twisted``.\n\nBy default ``twisted.internet.default`` is used to install the reactor.\nThis creates the same reactor that ``import twisted.internet.reactor``\nwould. Alternative reactors can be specified using the ``--reactor``\noption. This presently supports ``qt5reactor`` for use with ``pyqt5``\nand ``pytest-qt`` as well as ``asyncio``. This `guide`_ describes how to add\nsupport for a new reactor.\n\nThe reactor is automatically created prior to the first test but can\nbe explicitly installed earlier by calling\n``pytest_twisted.init_default_reactor()`` or the corresponding function\nfor the desired alternate reactor.\n\nBeware that in situations such as\na ``conftest.py`` file that the name ``pytest_twisted`` may be\nundesirably detected by ``pytest`` as an unknown hook. One alternative\nis to ``import pytest_twisted as pt``.\n\n\ninlineCallbacks\n===============\nUsing ``twisted.internet.defer.inlineCallbacks`` as a decorator for test\nfunctions, which use fixtures, does not work. Please use\n``pytest_twisted.inlineCallbacks`` instead.\n\n.. code-block:: python\n\n @pytest_twisted.inlineCallbacks\n def test_some_stuff(tmpdir):\n res = yield threads.deferToThread(os.listdir, tmpdir.strpath)\n assert res == []\n\n\nensureDeferred\n==============\nUsing ``twisted.internet.defer.ensureDeferred`` as a decorator for test\nfunctions, which use fixtures, does not work. Please use\n``pytest_twisted.ensureDeferred`` instead.\n\n.. code-block:: python\n\n @pytest_twisted.ensureDeferred\n async def test_some_stuff(tmpdir):\n res = await threads.deferToThread(os.listdir, tmpdir.strpath)\n assert res == []\n\n\nWaiting for deferreds in fixtures\n=================================\n``pytest_twisted.blockon`` allows fixtures to wait for deferreds.\n\n.. code-block:: python\n\n @pytest.fixture\n def val():\n d = defer.Deferred()\n reactor.callLater(1.0, d.callback, 10)\n return pytest_twisted.blockon(d)\n\n\nasync/await fixtures\n====================\n``async``/``await`` fixtures can be used along with ``yield`` for normal\npytest fixture semantics of setup, value, and teardown. At present only\nfunction scope is supported.\n\n.. code-block:: python\n\n @pytest_twisted.async_fixture\n async def foo():\n d1, d2 = defer.Deferred(), defer.Deferred()\n reactor.callLater(0.01, d1.callback, 42)\n reactor.callLater(0.02, d2.callback, 37)\n value = await d1\n yield value\n await d2\n\n\nThe twisted greenlet\n====================\nSome libraries (e.g. corotwine) need to know the greenlet, which is\nrunning the twisted reactor. It's available from the\n``twisted_greenlet`` fixture. The following code can be used to make\ncorotwine work with pytest-twisted.\n\n.. code-block:: python\n\n @pytest.fixture(scope=\"session\", autouse=True)\n def set_MAIN(request, twisted_greenlet):\n from corotwine import protocol\n protocol.MAIN = twisted_greenlet\n\n\nThat's (almost) all.\n\n\nDeprecations\n============\n\n----\nv1.9\n----\n\n``pytest.blockon``\n Use ``pytest_twisted.blockon``\n``pytest.inlineCallbacks``\n Use ``pytest_twisted.inlineCallbacks``\n\n\n.. |PyPI| image:: https://img.shields.io/pypi/v/pytest-twisted.svg\n :alt: PyPI version\n :target: https://pypi.python.org/pypi/pytest-twisted\n\n.. |Pythons| image:: https://img.shields.io/pypi/pyversions/pytest-twisted.svg\n :alt: Supported Python versions\n :target: https://pypi.python.org/pypi/pytest-twisted\n\n.. |Travis| image:: https://travis-ci.org/pytest-dev/pytest-twisted.svg?branch=master\n :alt: Travis build status\n :target: https://travis-ci.org/pytest-dev/pytest-twisted\n\n.. |AppVeyor| image:: https://ci.appveyor.com/api/projects/status/eb1vp9hysp463c66/branch/master?svg=true\n :alt: AppVeyor build status\n :target: https://ci.appveyor.com/project/pytestbot/pytest-twisted\n\n.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :alt: Black code style\n :target: https://github.com/ambv/black\n\n.. _guide: CONTRIBUTING.rst\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pytest-dev/pytest-twisted", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pytest-twisted", "package_url": "https://pypi.org/project/pytest-twisted/", "platform": "", "project_url": "https://pypi.org/project/pytest-twisted/", "project_urls": { "Homepage": "https://github.com/pytest-dev/pytest-twisted" }, "release_url": "https://pypi.org/project/pytest-twisted/1.12/", "requires_dist": [ "greenlet", "pytest (>=2.3)", "decorator", "pre-commit ; extra == 'dev'", "black ; extra == 'dev'" ], "requires_python": "", "summary": "A twisted plugin for py.test.", "version": "1.12" }, "last_serial": 5893947, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "2f5b8f7ede7dcbc1919b4512ff608759", "sha256": "a0375c7a06043a306d2466b1db5e5e687f9d8459e4eeb87943f7dd13e484c626" }, "downloads": -1, "filename": "pytest-twisted-1.0.zip", "has_sig": false, "md5_digest": "2f5b8f7ede7dcbc1919b4512ff608759", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5393, "upload_time": "2012-10-21T22:47:06", "url": "https://files.pythonhosted.org/packages/76/bd/c98244e0afb391454bd832207a4c5da4d3a0b0a44ad6b3b2aef6f9f48ac9/pytest-twisted-1.0.zip" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "61b12e5a7e42f33d18854314bd47e8a1", "sha256": "1e2f62c39e6a4f0079efb8a13d6ad1cccaa86200eab0e74b95e6c46453161b96" }, "downloads": -1, "filename": "pytest-twisted-1.1.zip", "has_sig": false, "md5_digest": "61b12e5a7e42f33d18854314bd47e8a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6713, "upload_time": "2012-10-23T08:10:25", "url": "https://files.pythonhosted.org/packages/d3/59/4accbaf7b7f199d058da5635e0bdbdd126783c84a6d037b063fb1a963057/pytest-twisted-1.1.zip" } ], "1.10": [ { "comment_text": "", "digests": { "md5": "7491aa1cf379000cfa173e869b0562b1", "sha256": "b13a8c53c1763ce5a7497dfe60b67d766dafe2b50f1353be0dd098cf76be2eac" }, "downloads": -1, "filename": "pytest-twisted-1.10.zip", "has_sig": false, "md5_digest": "7491aa1cf379000cfa173e869b0562b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13134, "upload_time": "2019-04-01T19:20:35", "url": "https://files.pythonhosted.org/packages/17/42/7a08d581834054c909b9604ec97ff2d9e923c7eaa1ea7012248fb8e6045e/pytest-twisted-1.10.zip" } ], "1.11": [ { "comment_text": "", "digests": { "md5": "dad71dde15bd4e6aa2adbba99c15e919", "sha256": "d9e6ba454ec099a5a992053f4206060db1c0f4c6598e7c347ad480726126b9e9" }, "downloads": -1, "filename": "pytest_twisted-1.11-py3-none-any.whl", "has_sig": false, "md5_digest": "dad71dde15bd4e6aa2adbba99c15e919", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5907, "upload_time": "2019-08-20T18:58:47", "url": "https://files.pythonhosted.org/packages/d4/73/0f9f0a95e38bc8ffde86d5eb6a4e5cc91253194c6341183ec11d4bae55c7/pytest_twisted-1.11-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "32fac434b777deb756fcf631c2b31e8b", "sha256": "a0dec27824549ac312d82e5883db0b151657c160627708b4674c7d4467a3f12d" }, "downloads": -1, "filename": "pytest-twisted-1.11.zip", "has_sig": false, "md5_digest": "32fac434b777deb756fcf631c2b31e8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13224, "upload_time": "2019-08-20T18:58:48", "url": "https://files.pythonhosted.org/packages/f2/93/686d4a9d39df8c22787e565a47f263fe0cb141d90021d5fe36f843e8b0db/pytest-twisted-1.11.zip" } ], "1.12": [ { "comment_text": "", "digests": { "md5": "dff30680abe0bfef5c5365f0662a6062", "sha256": "3b948221b0144a1e00c435ad89f0b99fb2aa6e19e215d3622be101ea26ff6c05" }, "downloads": -1, "filename": "pytest_twisted-1.12-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dff30680abe0bfef5c5365f0662a6062", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7002, "upload_time": "2019-09-27T03:54:41", "url": "https://files.pythonhosted.org/packages/75/f5/6b8d05c53d8b0d03e92171a2afd2571710db6eadb9836edb83e65a5c1d26/pytest_twisted-1.12-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2dc0fd9a58339735da854eb3d5f704a4", "sha256": "bb9af117c5c6063d9ef20ffdf2fa297caaf57de5a687e4d3607db7b0a6f74fea" }, "downloads": -1, "filename": "pytest-twisted-1.12.zip", "has_sig": false, "md5_digest": "2dc0fd9a58339735da854eb3d5f704a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15996, "upload_time": "2019-09-27T03:54:43", "url": "https://files.pythonhosted.org/packages/14/a2/9ee6475c39166c42e885e3147a779d17aa9c07874320473b3f4c5448fff2/pytest-twisted-1.12.zip" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "9110ada4cdbd7f93342a1c1ce240107d", "sha256": "01f83803e3e54ea568261d4daf62a14de61ff12c2f9619e877ee504f105b56ab" }, "downloads": -1, "filename": "pytest-twisted-1.2.zip", "has_sig": false, "md5_digest": "9110ada4cdbd7f93342a1c1ce240107d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6756, "upload_time": "2012-11-04T20:57:49", "url": "https://files.pythonhosted.org/packages/b9/d8/f168b93abd999b55b80084156f1340a0a79fdac0fa43d6cc7158d6e21b31/pytest-twisted-1.2.zip" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "c58a1d567e65ae238d6f9288742b6ed5", "sha256": "cfd2573ff01c799633259f3736eef8354239050150da43f3982e50083c73c2c9" }, "downloads": -1, "filename": "pytest-twisted-1.3.zip", "has_sig": false, "md5_digest": "c58a1d567e65ae238d6f9288742b6ed5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7568, "upload_time": "2012-11-21T23:48:00", "url": "https://files.pythonhosted.org/packages/f0/22/8f4df2fbbd032029f623c54537c05c75da2bd6d5ecbb33aaf51ac8885d12/pytest-twisted-1.3.zip" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "0a884202bb48c4eb905497e2aaf5f971", "sha256": "fd56ae7a8fd5b7bd60308eb0c7bec7b8b25f3578b6adcadc2b70b043f7e7adc8" }, "downloads": -1, "filename": "pytest-twisted-1.4.zip", "has_sig": false, "md5_digest": "0a884202bb48c4eb905497e2aaf5f971", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8292, "upload_time": "2012-11-26T07:50:37", "url": "https://files.pythonhosted.org/packages/32/da/a4f8ceb2e3b0bf268d9f4fe2e2f56afdaff065a5ef599cd482d456808818/pytest-twisted-1.4.zip" } ], "1.5": [ { "comment_text": "", "digests": { "md5": "769fc8d83084d0c4026eae8e6165f02a", "sha256": "c499814ed80e2aad809135d984383c92783d25c350a2e0eeddbdb82477ad72f8" }, "downloads": -1, "filename": "pytest_twisted-1.5-py27-none-any.whl", "has_sig": false, "md5_digest": "769fc8d83084d0c4026eae8e6165f02a", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 5599, "upload_time": "2014-02-04T12:04:14", "url": "https://files.pythonhosted.org/packages/0c/35/b745739c1d17e1758082fd4af9c265daaa2b6cc2d12c0480e17805195e61/pytest_twisted-1.5-py27-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a56ac6c08208f515b681746ab17da96c", "sha256": "d0dc887f15f4d0ade882e56590a3cce95b70fd0687ba8d2428a6364f3288d87e" }, "downloads": -1, "filename": "pytest-twisted-1.5.zip", "has_sig": false, "md5_digest": "a56ac6c08208f515b681746ab17da96c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8557, "upload_time": "2014-02-04T12:03:41", "url": "https://files.pythonhosted.org/packages/74/66/0c64463ed9501c09e4c79bc924743e2e4cd02eb4498d492b5e3c81911198/pytest-twisted-1.5.zip" } ], "1.6": [ { "comment_text": "", "digests": { "md5": "ce64144bee24d49ba9db6198db1e6762", "sha256": "0492946bd7c6d0afaa884a3b618a2a62d9d769ff41441d0f520c916195c21bc6" }, "downloads": -1, "filename": "pytest-twisted-1.6.zip", "has_sig": false, "md5_digest": "ce64144bee24d49ba9db6198db1e6762", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7997, "upload_time": "2018-01-12T10:59:08", "url": "https://files.pythonhosted.org/packages/da/e8/920a822033ceca7d59cd0f4d73bbc45608404e6f0736de663ae022543146/pytest-twisted-1.6.zip" } ], "1.7": [ { "comment_text": "", "digests": { "md5": "5afa01b08f62a7e476e9deb9591f10cc", "sha256": "9c9ecfc5492a73d106a253df16d8fd66b2b8fe3ca34e83eabf0d58ce615aaeb9" }, "downloads": -1, "filename": "pytest-twisted-1.7.zip", "has_sig": false, "md5_digest": "5afa01b08f62a7e476e9deb9591f10cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11419, "upload_time": "2018-03-08T10:08:51", "url": "https://files.pythonhosted.org/packages/63/41/b8d84b5663a7e578cc11ceb68fe2381f1411d6845136601cf4662ec02227/pytest-twisted-1.7.zip" } ], "1.7.1": [ { "comment_text": "", "digests": { "md5": "a0d1a027ae638afb12d532020134a4fd", "sha256": "4ff3d241ece853976ed3cef8de624f4122153b6fa8118d5801a293abd3bb7538" }, "downloads": -1, "filename": "pytest-twisted-1.7.1.zip", "has_sig": false, "md5_digest": "a0d1a027ae638afb12d532020134a4fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11530, "upload_time": "2018-03-08T12:58:49", "url": "https://files.pythonhosted.org/packages/29/d5/5c4f1f02df049871dc8e1c7598d862008dca3be5060ad4072cd6b8d629e3/pytest-twisted-1.7.1.zip" } ], "1.8": [ { "comment_text": "", "digests": { "md5": "d1f2f6614ac4d266220bc781c694266f", "sha256": "6c3a0db55e0af2320b43b7ac9fe3045147b8148f6f1bfe1ce1b48f72e7d4ee13" }, "downloads": -1, "filename": "pytest-twisted-1.8.zip", "has_sig": false, "md5_digest": "d1f2f6614ac4d266220bc781c694266f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11471, "upload_time": "2018-05-01T09:38:40", "url": "https://files.pythonhosted.org/packages/fd/1e/d5ae0034e20750b6e7f9270af70bfa83e95707c538939511d460f0e4c5fc/pytest-twisted-1.8.zip" } ], "1.9": [ { "comment_text": "", "digests": { "md5": "1940314014a6f9b569574f3973ee2a70", "sha256": "6396e3d46c9acc8dda6c408aef74cb36c252621ee8387797984ba35ab6ef600a" }, "downloads": -1, "filename": "pytest-twisted-1.9.zip", "has_sig": false, "md5_digest": "1940314014a6f9b569574f3973ee2a70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12711, "upload_time": "2019-01-22T03:28:32", "url": "https://files.pythonhosted.org/packages/91/25/ce509583db748cb1036ed899121619eef89c38b81fe7d45aa65357a8efe1/pytest-twisted-1.9.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dff30680abe0bfef5c5365f0662a6062", "sha256": "3b948221b0144a1e00c435ad89f0b99fb2aa6e19e215d3622be101ea26ff6c05" }, "downloads": -1, "filename": "pytest_twisted-1.12-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dff30680abe0bfef5c5365f0662a6062", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7002, "upload_time": "2019-09-27T03:54:41", "url": "https://files.pythonhosted.org/packages/75/f5/6b8d05c53d8b0d03e92171a2afd2571710db6eadb9836edb83e65a5c1d26/pytest_twisted-1.12-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2dc0fd9a58339735da854eb3d5f704a4", "sha256": "bb9af117c5c6063d9ef20ffdf2fa297caaf57de5a687e4d3607db7b0a6f74fea" }, "downloads": -1, "filename": "pytest-twisted-1.12.zip", "has_sig": false, "md5_digest": "2dc0fd9a58339735da854eb3d5f704a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15996, "upload_time": "2019-09-27T03:54:43", "url": "https://files.pythonhosted.org/packages/14/a2/9ee6475c39166c42e885e3147a779d17aa9c07874320473b3f4c5448fff2/pytest-twisted-1.12.zip" } ] }