{ "info": { "author": "Authentise, Inc.", "author_email": "engineering@authentise.com", "bugtrack_url": null, "classifiers": [], "description": "pytest-raises\n===================================\n\n[![Current Build Status](https://travis-ci.org/Authentise/pytest-raises.svg?branch=master)](https://travis-ci.org/Authentise/pytest-raises)\n\nA [pytest][] plugin implementation of pytest.raises as a pytest.mark fixture\n\nFeatures\n--------\n\nAdds functionality for marking tests with a `pytest.mark.raises` fixture, which functions similarly to using `with pytest.raises`\n\n\nRequirements\n------------\n\n- python 2.7 or above\n- pytest 2.8.1 or above\n\n\nInstallation\n------------\n\nYou can install \"pytest-raises\" via [pip][] from [PyPI][]\n\n```\n$ pip install pytest-raises\n```\n\nUsage\n-----\n\nMarking a test with the `@pytest.mark.raises()` decorator will mark that the code the test executes is expected to raise an error. This is different from `@pytest.mark.xfail()` as it does not mean the test itself might fail, but instead that the \"pass\" for the test is that the code raises an error.\n\nIt accepts an `exception` keyword argument, which is the class of error expected to be raised.\n\nIt will allow tests which raise errors to pass. The main usage is to assert that an error of a specific type is raise.\n\nA very simple example is:\n\n```python\nimport pytest\n\nclass SomeException(Exception):\n pass\n\nclass AnotherException(Exception):\n pass\n\n@pytest.mark.raises(exception = SomeException)\ndef test_mark_raises_named():\n raise SomeException('the message')\n\n@pytest.mark.raises()\ndef test_mark_raises_general():\n raise AnotherException('the message')\n\n```\n\nA more useful example using test parametrization is:\n\n```python\nimport pytest\n\nclass SomeException(Exception):\n pass\n\nclass AnotherException(Exception):\n pass\n\n@pytest.mark.parametrize('error', [\n None,\n pytest.mark.raises(SomeException('the message'), exception=SomeException),\n pytest.mark.raises(AnotherException('the message'), exception=AnotherException),\n pytest.mark.raises(Exception('the message')),\n])\ndef test_mark_raises(error):\n if error:\n raise error\n\n```\n\nAll of these tests pass. These examples are actual [tests for this plugin][].\n\nLicense\n-------\n\nDistributed under the terms of the [MIT][] license, \"pytest-raises\" is free and open source software\n\n\nIssues\n------\n\nIf you encounter any problems, please [file an issue][] along with a detailed description.\n\n[MIT]: http://opensource.org/licenses/MIT\n[file an issue]: https://github.com/Authentise/pytest-raises/issues\n[pytest]: https://github.com/pytest-dev/pytest\n[tests for this plugin]: https://github.com/Authentise/pytest-raises/blob/master/tests/test_raises.py\n[pip]: https://pypi.python.org/pypi/pip/\n[PyPI]: https://pypi.python.org/pypi", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Authentise/pytest-raises", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pytest-raises", "package_url": "https://pypi.org/project/pytest-raises/", "platform": "", "project_url": "https://pypi.org/project/pytest-raises/", "project_urls": { "Homepage": "https://github.com/Authentise/pytest-raises" }, "release_url": "https://pypi.org/project/pytest-raises/0.10/", "requires_dist": null, "requires_python": "", "summary": "An implementation of pytest.raises as a pytest.mark fixture", "version": "0.10" }, "last_serial": 4466696, "releases": { "0.0.1": [], "0.10": [ { "comment_text": "", "digests": { "md5": "1e8f9f040cc47ebb322b10c26a763250", "sha256": "4710a8921b0b7425cd2073d696862ecf99922ef522e681cc63a52008112d63d9" }, "downloads": -1, "filename": "pytest-raises-0.10.tar.gz", "has_sig": false, "md5_digest": "1e8f9f040cc47ebb322b10c26a763250", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7274, "upload_time": "2018-11-08T19:05:16", "url": "https://files.pythonhosted.org/packages/6f/37/e1682534d84899dab81943bc69fb0f01fd3164d0fa889480ce1937589533/pytest-raises-0.10.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "46d5467accddd9f1c8add0c6bb125d1e", "sha256": "12e5626b2eb0d8c4befec49a810e2960ad31af3d0cb68ba435ad1963ba8df406" }, "downloads": -1, "filename": "pytest-raises-0.2.tar.gz", "has_sig": false, "md5_digest": "46d5467accddd9f1c8add0c6bb125d1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3494, "upload_time": "2016-03-21T23:49:37", "url": "https://files.pythonhosted.org/packages/b0/c8/295ac4d600ca84a5eb1d3e67a5e7e2f92f53c2d49880a5326d6e613fed28/pytest-raises-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "2efe1365270062e2328d7724d4632a90", "sha256": "2302bf4a0ef31a4b7cb4d248127e47dedf42dbb083d442c4b54b4d3e002a3cb1" }, "downloads": -1, "filename": "pytest-raises-0.3.tar.gz", "has_sig": false, "md5_digest": "2efe1365270062e2328d7724d4632a90", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3747, "upload_time": "2016-03-21T23:59:42", "url": "https://files.pythonhosted.org/packages/e8/aa/f96100d632f25c2669ff1301f1eee71f8dcb0071f276d35baa8261b7b80f/pytest-raises-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "0da5c58c1cb40fc21d1394898361667d", "sha256": "0702264d5e78cdeaf3b592bebbaeed0575a0a7f156174994a08c527bf626d032" }, "downloads": -1, "filename": "pytest-raises-0.4.tar.gz", "has_sig": false, "md5_digest": "0da5c58c1cb40fc21d1394898361667d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3893, "upload_time": "2016-03-24T19:34:09", "url": "https://files.pythonhosted.org/packages/5f/f1/cf37a9662e058bfa94d0d591bdef20dd2c6bb1407fdec9078703ce68085a/pytest-raises-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "b0c72bb6f551fb2560bc73a773b3eb07", "sha256": "4fcb0e8a6f5b392e3336302c7ce8f79c0087b79c0b830a017f6d78ee7077f684" }, "downloads": -1, "filename": "pytest-raises-0.5.tar.gz", "has_sig": false, "md5_digest": "b0c72bb6f551fb2560bc73a773b3eb07", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3747, "upload_time": "2016-04-26T17:15:50", "url": "https://files.pythonhosted.org/packages/78/89/96bba4183b97308df961108a8b150e1f414cd95275a01d6f9bec79b41e30/pytest-raises-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "fc59c5e61fb0b1757d8e37ae3afb24ab", "sha256": "3fdf1a1e0a001653bfd7bd59c9d1360ebb292052e5b2008287e7f2a7a2fc54fd" }, "downloads": -1, "filename": "pytest-raises-0.6.tar.gz", "has_sig": false, "md5_digest": "fc59c5e61fb0b1757d8e37ae3afb24ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3758, "upload_time": "2016-06-10T16:49:52", "url": "https://files.pythonhosted.org/packages/2c/24/2014219e606046ca8e4f062388f11dab604826cd93465ae39960276d57bb/pytest-raises-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "96d55a1a827d1af0ad81c23b2753d9ca", "sha256": "03845e093f53ff3d5bb21a9d0525cb5ea8c36bd887887203ac7b1db8b5f85fc0" }, "downloads": -1, "filename": "pytest-raises-0.7.tar.gz", "has_sig": false, "md5_digest": "96d55a1a827d1af0ad81c23b2753d9ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3886, "upload_time": "2017-10-16T17:49:41", "url": "https://files.pythonhosted.org/packages/05/ce/e77800866e07239135b022f433ff40dce5671b8a62dcaffcb8d74e0c2ec5/pytest-raises-0.7.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "66138de71823aad736c394c68ce9c1f3", "sha256": "881f5ef2ebca4b8d7d47b6608b9b4407a87b84f7954e776a09e2b4cbfb0dc6ae" }, "downloads": -1, "filename": "pytest-raises-0.8.tar.gz", "has_sig": false, "md5_digest": "66138de71823aad736c394c68ce9c1f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3925, "upload_time": "2018-05-30T18:07:38", "url": "https://files.pythonhosted.org/packages/9e/dc/dbb517aa9e9a47c432ca0d64ab4e5b68a219eb10ebcaada114cf6b5cea62/pytest-raises-0.8.tar.gz" } ], "0.8.post0.dev3": [ { "comment_text": "", "digests": { "md5": "6514e85876e2e9b3622b6f059da65dfe", "sha256": "784e3e42fc6be9985ad83cb1290304c1e31a0de4605100d2d8c0984464ffdfd8" }, "downloads": -1, "filename": "pytest-raises-0.8.post0.dev3.tar.gz", "has_sig": false, "md5_digest": "6514e85876e2e9b3622b6f059da65dfe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4086, "upload_time": "2018-09-24T19:42:28", "url": "https://files.pythonhosted.org/packages/85/8b/c965c91b352703885f948c47d4cea4ba1bfbeb2cea5fe82368771a369bf1/pytest-raises-0.8.post0.dev3.tar.gz" } ], "0.9": [ { "comment_text": "", "digests": { "md5": "a25d687502df9b94e1b365fcac25ce5f", "sha256": "6844e7b85e44bd383911844ed004b38b9c5a6cb2c56641af8fdc8dad322e4141" }, "downloads": -1, "filename": "pytest-raises-0.9.tar.gz", "has_sig": false, "md5_digest": "a25d687502df9b94e1b365fcac25ce5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4078, "upload_time": "2018-09-24T19:48:40", "url": "https://files.pythonhosted.org/packages/8d/0b/6167cc3013ea64b9b8cbc1e934006a97d36313fc8d9bd1bc0af1c2ed7e34/pytest-raises-0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1e8f9f040cc47ebb322b10c26a763250", "sha256": "4710a8921b0b7425cd2073d696862ecf99922ef522e681cc63a52008112d63d9" }, "downloads": -1, "filename": "pytest-raises-0.10.tar.gz", "has_sig": false, "md5_digest": "1e8f9f040cc47ebb322b10c26a763250", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7274, "upload_time": "2018-11-08T19:05:16", "url": "https://files.pythonhosted.org/packages/6f/37/e1682534d84899dab81943bc69fb0f01fd3164d0fa889480ce1937589533/pytest-raises-0.10.tar.gz" } ] }