{ "info": { "author": "Eugeniy Kalinin", "author_email": "burump@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Plugins", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development", "Topic :: Software Development :: Testing" ], "description": "pytest-tornado\n==============\n\n.. image:: https://travis-ci.org/vidartf/pytest-tornado.svg?branch=master\n :target: https://travis-ci.org/vidartf/pytest-tornado\n\nA py.test_ plugin providing fixtures and markers to simplify testing\nof asynchronous tornado applications.\n\nInstallation\n------------\n\n::\n\n pip install pytest-tornado\n\n\nExample\n-------\n\n.. code-block:: python\n\n import pytest\n import tornado.web\n\n class MainHandler(tornado.web.RequestHandler):\n def get(self):\n self.write(\"Hello, world\")\n\n application = tornado.web.Application([\n (r\"/\", MainHandler),\n ])\n\n @pytest.fixture\n def app():\n return application\n\n @pytest.mark.gen_test\n def test_hello_world(http_client, base_url):\n response = yield http_client.fetch(base_url)\n assert response.code == 200\n\n\nRunning tests\n-------------\n\n::\n\n py.test\n\n\nFixtures\n--------\n\nio_loop\n creates an instance of the `tornado.ioloop.IOLoop`_ for each test case\n\nhttp_port\n get a port used by the test server\n\nbase_url\n get an absolute base url for the test server,\n for example, ``http://localhost:59828``\n\nhttp_server\n start a tornado HTTP server, you must create an ``app`` fixture,\n which returns the `tornado.web.Application`_ to be tested\n\nhttp_client\n get an asynchronous HTTP client\n\n\nShow fixtures provided by the plugin::\n\n py.test --fixtures\n\n\nMarkers\n-------\n\nA ``gen_test`` marker lets you write a coroutine-style tests used with the\n`tornado.gen`_ module:\n\n.. code-block:: python\n\n @pytest.mark.gen_test\n def test_tornado(http_client):\n response = yield http_client.fetch('http://www.tornadoweb.org/')\n assert response.code == 200\n\n\nMarked tests will time out after 5 seconds. The timeout can be modified by\nsetting an ``ASYNC_TEST_TIMEOUT`` environment variable,\n``--async-test-timeout`` command line argument or a marker argument.\n\n.. code-block:: python\n\n @pytest.mark.gen_test(timeout=5)\n def test_tornado(http_client):\n yield http_client.fetch('http://www.tornadoweb.org/')\n\nThe mark can also receive a run_sync flag, which if turned off will, instead of running the test synchronously, will add it as a coroutine and run the IOLoop (until the timeout). For instance, this allows to test things on both a client and a server at the same time. \n\n.. code-block:: python\n\n @pytest.mark.gen_test(run_sync=False)\n def test_tornado(http_server, http_client):\n response = yield http_client.fetch('http://localhost:5555/my_local_server_test/')\n assert response.body == 'Run on the same IOLoop!'\n\n\nShow markers provided by the plugin::\n\n py.test --markers\n\n\n.. _py.test: http://pytest.org/\n.. _`tornado.ioloop.IOLoop`: http://tornado.readthedocs.org/en/latest/ioloop.html#ioloop-objects\n.. _`tornado.web.Application`: http://tornado.readthedocs.org/en/latest/web.html#application-configuration\n.. _`tornado.gen`: http://tornado.readthedocs.org/en/latest/gen.html\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vidartf/pytest-tornado", "keywords": "pytest py.test tornado async asynchronous testing unit tests plugin", "license": "Apache License, Version 2.0", "maintainer": "Vidar Tonaas Fauske", "maintainer_email": "vidartf@gmail.com", "name": "pytest-tornado5", "package_url": "https://pypi.org/project/pytest-tornado5/", "platform": "", "project_url": "https://pypi.org/project/pytest-tornado5/", "project_urls": { "Homepage": "https://github.com/vidartf/pytest-tornado" }, "release_url": "https://pypi.org/project/pytest-tornado5/2.0.0/", "requires_dist": [ "pytest (>=3.6)", "tornado (>=5)" ], "requires_python": "", "summary": "A py.test plugin providing fixtures and markers to simplify testing of asynchronous tornado applications.", "version": "2.0.0" }, "last_serial": 4494162, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "385795c78278f9dee98373ce35936412", "sha256": "77a6fbd3f208f79eb262db7c1ceac2140bb7af1d6f39b4cabf978a9767928125" }, "downloads": -1, "filename": "pytest_tornado5-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "385795c78278f9dee98373ce35936412", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10544, "upload_time": "2018-03-14T12:56:04", "url": "https://files.pythonhosted.org/packages/c8/94/63449c082e8f91f843dd55c535a530a7a9d8a96e3ef1574049ce948e42b1/pytest_tornado5-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b4de0a1d442cca30459f54c429f41b31", "sha256": "1deadb5e27d2d44d112e0eb5d969ac9c079c75232062db57072372a3f5f366af" }, "downloads": -1, "filename": "pytest-tornado5-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b4de0a1d442cca30459f54c429f41b31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10063, "upload_time": "2018-03-14T12:56:06", "url": "https://files.pythonhosted.org/packages/69/ac/30047af66de0711a7686a56c29385df8bd180894f1d1383d065c3fbaebe9/pytest-tornado5-1.0.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "988caac954f818044bd1c63f6b30266e", "sha256": "a61164e1f34603be446c17f778b1e6d53e3153c0e68f47e632fe6184357c2f45" }, "downloads": -1, "filename": "pytest_tornado5-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "988caac954f818044bd1c63f6b30266e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4896, "upload_time": "2018-11-16T15:57:10", "url": "https://files.pythonhosted.org/packages/5b/86/18862ee76649dd69416c1ff3228ca0872826cbc361edc6fb5dfa3dc3c17e/pytest_tornado5-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7d3c4c67b8b0fcde4ec9ca84f04e9688", "sha256": "0de5eaaff0af802a6557dd5e27ab8eab94e363c7e07a419237b9032eb8146661" }, "downloads": -1, "filename": "pytest-tornado5-2.0.0.tar.gz", "has_sig": false, "md5_digest": "7d3c4c67b8b0fcde4ec9ca84f04e9688", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9990, "upload_time": "2018-11-16T15:57:12", "url": "https://files.pythonhosted.org/packages/d0/dc/3c22d68bd33ceed02cafd32b69f4501963465e11f559d335af8781e0a03f/pytest-tornado5-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "988caac954f818044bd1c63f6b30266e", "sha256": "a61164e1f34603be446c17f778b1e6d53e3153c0e68f47e632fe6184357c2f45" }, "downloads": -1, "filename": "pytest_tornado5-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "988caac954f818044bd1c63f6b30266e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4896, "upload_time": "2018-11-16T15:57:10", "url": "https://files.pythonhosted.org/packages/5b/86/18862ee76649dd69416c1ff3228ca0872826cbc361edc6fb5dfa3dc3c17e/pytest_tornado5-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7d3c4c67b8b0fcde4ec9ca84f04e9688", "sha256": "0de5eaaff0af802a6557dd5e27ab8eab94e363c7e07a419237b9032eb8146661" }, "downloads": -1, "filename": "pytest-tornado5-2.0.0.tar.gz", "has_sig": false, "md5_digest": "7d3c4c67b8b0fcde4ec9ca84f04e9688", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9990, "upload_time": "2018-11-16T15:57:12", "url": "https://files.pythonhosted.org/packages/d0/dc/3c22d68bd33ceed02cafd32b69f4501963465e11f559d335af8781e0a03f/pytest-tornado5-2.0.0.tar.gz" } ] }