{ "info": { "author": "Hiroyuki Takagi", "author_email": "miyako.dev@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "XFail\n=====\n\n.. image:: https://img.shields.io/pypi/v/xfail.svg\n :target: https://pypi.python.org/pypi/xfail\n\n.. image:: https://img.shields.io/pypi/pyversions/xfail.svg\n :target: https://pypi.python.org/pypi/xfail\n\n.. image:: https://img.shields.io/travis/miyakogi/xfail.py.svg\n :target: https://travis-ci.org/miyakogi/xfail.py\n\n.. image:: https://codecov.io/github/miyakogi/xfail.py/coverage.svg?branch=master\n :target: https://codecov.io/github/miyakogi/xfail.py?branch=master\n\n\nXFail provides a decorator function ``xfail`` to skip expected exceptions.\nSimilar to unittest.skipIf, but ``xfail`` can specify which exception should be\nskipped, and raise if the decorated function is unexpectedly passed (only if\n``strict`` is ``True``).\n\nInstall\n-------\n\nSupported python versions are: 2.7, 3.4, 3.5, 3.6\n\nCan be installed from PyPI by pip::\n\n pip install xfail\n\nUsage\n-----\n\nxfail decorator\n^^^^^^^^^^^^^^^\n\n``xfail`` accepts two arguments, ``exceptions`` and ``strict``.\n\nThe first argument (``exceptions``) should be an Exception class to skip (Ex.\n``Exception``, ``AssertionError``, and so on). If you want to skip multiple\nexceptions, use tuple of them, for example, ``@xfail((AssertionError,\nValueError))``.\n\nThe second argument ``strict`` should be a boolean. If ``strict`` is ``False``\n(by default) and passed unexpectedly, raise ``unittest.SkipTest`` exception,\nwhich will mark the test is skipped. This case is very similar to the function\nis decorated by ``uniteest.skip`` function and the test will be counted as\nskipped.\n\n If it is ``True`` and the decorated function did not raise (any of) the\n expected exception(s), ``XPassFailure`` exception would be raised.\n In this case, the test will be counted as fail.\n\n.. code-block:: py\n\n from xfail import xfail\n\n @xfail(IndexError)\n def get(l, index):\n return l[index]\n\n l = [1, 2, 3]\n get(4) # no error\n\nAlso supports multiple exceptions:\n\n.. code-block:: py\n\n @xfail((IndexError, ValueError))\n def a():\n '''This function passes IndexError and ValueError\n ...\n\nIn test script, similar to ``unittest.TestCase.assertRaises``:\n\n.. code-block:: py\n\n from unittest import TestCase\n from xfail import xfail\n\n class MyTest(TestCase):\n def test_1(self):\n @xfail(AssertionError)\n def should_raise_error():\n assert False\n a() # test passes\n\n def test_2(self):\n @xfail(AssertionError, strict=True)\n def should_raise_error():\n assert True\n a() # test failes, since this function should raise AssertionError\n\n # Can be used for test function\n @xfail(AssertionError, strict=True)\n def test_3(self)\n assert False\n\n # This test will fail\n @xfail(AssertionError, strict=True)\n def test_3(self)\n assert True\n\nFor more exapmles, see `test_xfail.py `_.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/miyakogi/xfail.py", "keywords": "xfail", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "xfail", "package_url": "https://pypi.org/project/xfail/", "platform": "", "project_url": "https://pypi.org/project/xfail/", "project_urls": { "Homepage": "https://github.com/miyakogi/xfail.py" }, "release_url": "https://pypi.org/project/xfail/1.1.2/", "requires_dist": null, "requires_python": "", "summary": "Skip expected failures", "version": "1.1.2" }, "last_serial": 2922168, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "a9ed9c0ee410fb578e47b90c2de075cc", "sha256": "8c9d0b13e7b620e5b96cd19ec81cdf3e67fce8005e1877c605bfa02aa66aa427" }, "downloads": -1, "filename": "xfail-1.0.0.tar.gz", "has_sig": false, "md5_digest": "a9ed9c0ee410fb578e47b90c2de075cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2712, "upload_time": "2016-04-19T08:43:50", "url": "https://files.pythonhosted.org/packages/22/ef/e2443063f6bfd8533e119ed0679706b406d0a86027a5d17cb889400dc0e2/xfail-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "1c24500b8ab9743b8e244e79e124b5f0", "sha256": "0ba29eb2596475df2e7e27860555567dd20836f53b28137dc67a01cc44039c91" }, "downloads": -1, "filename": "xfail-1.0.1.tar.gz", "has_sig": false, "md5_digest": "1c24500b8ab9743b8e244e79e124b5f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2800, "upload_time": "2016-04-19T08:59:37", "url": "https://files.pythonhosted.org/packages/b6/6c/2988301be9eb409b48817f85d8c660cfcb502318fd54a7cc79f4be0b3a73/xfail-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "f4bf79200edc78304eaf3d91f173463f", "sha256": "b3fa0540cec3bf3a8e100f860989455022c295262777fe8784f371c214a71f5b" }, "downloads": -1, "filename": "xfail-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f4bf79200edc78304eaf3d91f173463f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2978, "upload_time": "2016-05-03T14:38:16", "url": "https://files.pythonhosted.org/packages/ce/36/aa9bf1e29bc6a7347b6a3b20fba3afe25e2446d5862544913bca2c6bbde6/xfail-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "6fa95f2812bfbbb1e03c2f9e2b84082f", "sha256": "0c6549fab6090481f3619e9a1f45b311bbf69488a45e603f32f8f4bfd383ccfe" }, "downloads": -1, "filename": "xfail-1.1.1.tar.gz", "has_sig": false, "md5_digest": "6fa95f2812bfbbb1e03c2f9e2b84082f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2961, "upload_time": "2017-01-23T04:29:18", "url": "https://files.pythonhosted.org/packages/08/60/a1286877a7187fb918c0eaef6baf9b227bcde600050643294b3bbf02fbab/xfail-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "2611f710018ecec27704a4de7f53e3a6", "sha256": "db965380e89e26f114292393906367939e796a4aecf998fcd6e8a775e2a10f30" }, "downloads": -1, "filename": "xfail-1.1.2.tar.gz", "has_sig": false, "md5_digest": "2611f710018ecec27704a4de7f53e3a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3109, "upload_time": "2017-06-03T04:52:53", "url": "https://files.pythonhosted.org/packages/df/08/ca9fb927bba75e65edce89f0d5da1927a1ac42eaf18c726b7096dfb48bbf/xfail-1.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2611f710018ecec27704a4de7f53e3a6", "sha256": "db965380e89e26f114292393906367939e796a4aecf998fcd6e8a775e2a10f30" }, "downloads": -1, "filename": "xfail-1.1.2.tar.gz", "has_sig": false, "md5_digest": "2611f710018ecec27704a4de7f53e3a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3109, "upload_time": "2017-06-03T04:52:53", "url": "https://files.pythonhosted.org/packages/df/08/ca9fb927bba75e65edce89f0d5da1927a1ac42eaf18c726b7096dfb48bbf/xfail-1.1.2.tar.gz" } ] }