{ "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/eugeniy/pytest-tornado.svg?branch=master\n :target: https://travis-ci.org/eugeniy/pytest-tornado\n\n.. image:: https://coveralls.io/repos/eugeniy/pytest-tornado/badge.svg\n :target: https://coveralls.io/r/eugeniy/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", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yen3/pytest-tornado", "keywords": "pytest py.test tornado async asynchronous testing unit tests plugin", "license": "Apache License, Version 2.0", "maintainer": "", "maintainer_email": "", "name": "pytest-tornado-yen3", "package_url": "https://pypi.org/project/pytest-tornado-yen3/", "platform": "", "project_url": "https://pypi.org/project/pytest-tornado-yen3/", "project_urls": { "Homepage": "https://github.com/yen3/pytest-tornado" }, "release_url": "https://pypi.org/project/pytest-tornado-yen3/0.5.2/", "requires_dist": null, "requires_python": "", "summary": "A py.test plugin providing fixtures and markers to simplify testing of asynchronous tornado applications.", "version": "0.5.2" }, "last_serial": 4376683, "releases": { "0.4.6": [ { "comment_text": "", "digests": { "md5": "4964ede227055eba43ca9467b142578b", "sha256": "a02e13f91405a8e4023bea4b8a81dc460c7f72e50a1f02b1f73a55c6cefce7aa" }, "downloads": -1, "filename": "pytest_tornado_yen3-0.4.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4964ede227055eba43ca9467b142578b", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 7910, "upload_time": "2018-01-14T08:25:23", "url": "https://files.pythonhosted.org/packages/89/a6/72bc6a7e6ee5a907035f2ef7949531d680fcbad1ffc7e96735105f750dfb/pytest_tornado_yen3-0.4.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "31a2c0a5d91b9fe6df7b717444680a5f", "sha256": "dfdf8d57c63d6e6725e8e98227242cbae7e0b1536c368b44c2c489dae7d159be" }, "downloads": -1, "filename": "pytest-tornado-yen3-0.4.6.tar.gz", "has_sig": false, "md5_digest": "31a2c0a5d91b9fe6df7b717444680a5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5000, "upload_time": "2018-01-14T08:25:14", "url": "https://files.pythonhosted.org/packages/27/07/6c1f537534c5a610feb406adbdbe6b36a649274af3a732ef1c605b97bdf6/pytest-tornado-yen3-0.4.6.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "dd31f5b809509685e5463f4dd1a00041", "sha256": "ba485a043704f9ea9f4915c6472400968e8559822d3a35d4fe70df69a64bde51" }, "downloads": -1, "filename": "pytest-tornado-yen3-0.5.1.tar.gz", "has_sig": false, "md5_digest": "dd31f5b809509685e5463f4dd1a00041", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4801, "upload_time": "2018-10-15T07:13:30", "url": "https://files.pythonhosted.org/packages/84/e0/e601afa96a671367173cd4379b8ceae9c3010a7823a128910f7f26888906/pytest-tornado-yen3-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "7283a2e285f060d4cea2a8c238f44657", "sha256": "da9a456d91da059aa094a167f69a8c8a05b4cc7d0d563cb2760e1c0f718429f1" }, "downloads": -1, "filename": "pytest-tornado-yen3-0.5.2.tar.gz", "has_sig": false, "md5_digest": "7283a2e285f060d4cea2a8c238f44657", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4833, "upload_time": "2018-10-15T08:12:47", "url": "https://files.pythonhosted.org/packages/c6/af/bddf181d99e9e08203a0e14c7cc19f74d1eaf9410f85d2dc00a12000aa50/pytest-tornado-yen3-0.5.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7283a2e285f060d4cea2a8c238f44657", "sha256": "da9a456d91da059aa094a167f69a8c8a05b4cc7d0d563cb2760e1c0f718429f1" }, "downloads": -1, "filename": "pytest-tornado-yen3-0.5.2.tar.gz", "has_sig": false, "md5_digest": "7283a2e285f060d4cea2a8c238f44657", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4833, "upload_time": "2018-10-15T08:12:47", "url": "https://files.pythonhosted.org/packages/c6/af/bddf181d99e9e08203a0e14c7cc19f74d1eaf9410f85d2dc00a12000aa50/pytest-tornado-yen3-0.5.2.tar.gz" } ] }