{ "info": { "author": "Matt Duck", "author_email": "matt@mattduck.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Testing" ], "description": "pytest-it\n=========\n\n|PyPI| |Travis|\n\nDecorate your pytest suite with `RSpec-inspired `_ markers ``describe``, ``context`` and\n``it``. Then run ``pytest --it`` to see a plaintext, org-mode compatible spec of the\ntest structure.\n\n.. image:: img/output-example.png\n\n\n\nInstall\n-------\n\n``pytest-it`` is `available on PyPi `_: ``pip install pytest-it``.\n\n\nExamples\n--------\n\nA basic example that uses ``pytest.mark.describe``, ``pytest.mark.context`` and ``pytest.mark.it``:\n\n.. code-block:: python\n\n from pytest import mark as m\n\n @m.describe(\"The test function report format\")\n class TestPytestItExample(object):\n\n @m.context(\"When @pytest.mark.it is used\")\n @m.it(\"Displays an '- It: ' block matching the decorator\")\n def test_it_decorator(self, testdir):\n pass\n\nThis produces::\n\n - Describe: The test function report format...\n\n - Context: When @pytest.mark.it is used...\n - \u2713 It: Displays an '- It: ' block matching the decorator\n\n\n``Describe`` and ``Context`` blocks can be nested arbitrarily by using multiple\nmarkers, eg:\n\n.. code-block:: python\n\n from pytest import mark as m\n\n @m.describe(\"The test function report format\")\n class TestPytestItExample(object):\n\n @m.context(\"When @pytest.mark.it is not used\")\n @m.it(\"Displays the test function name\")\n def test_no_argument(self, testdir):\n pass\n\n @m.context(\"When @pytest.mark.it is not used\")\n @m.context(\"but the test name starts with 'test_it_'\")\n @m.it(\"Prettifies the test name into the 'It: ' value\")\n def test_populates_the_it_marker_using_function_name(self, testdir):\n pass\n\nThis produces::\n\n - Describe: The test function report format...\n\n - Context: When @pytest.mark.it is not used...\n - \u2713 It: Displays the test function name\n\n - ...but the test name starts with 'test_it_'...\n - \u2713 It: Prettifies the test name into the 'It: ' value\n\n\nBehaviour\n---------\n\n- Pytest markers are used to specify the ``Describe:``, ``Context:`` and ``It:``\n sections. You can set these in all the usual ways that you specify pytest\n markers.\n\n- ``Describe`` and ``Context`` can be nested arbitrarily.\n\n- If ``--collect-only`` is used, it displays the same ``pytest-it`` spec as usual, but\n without the test result (\u2713/F/s).\n\n- If ``-v`` is higher than 0, the full path to the test function is include in the\n test name.\n\n- If ``pytest.mark.it`` is not used on a test, the test name is displayed instead\n of the ``It: does something`` output.\n\n- If ``pytest.mark.it`` is not used but the test name starts with ``test_it``,\n ``pytest-it`` will prettify the test name into an ``It: does something`` value.\n\n- The test output should be able to be copied directly into an `org-mode `_ file.\n\n\nBackground\n-----------\n\nPytest provides a lot of useful features for testing in Python, but when testing\ncomplex systems, it can be hard to clearly communicate the intent of a test\nusing the standard ``test_module.py::TestClass::test_function`` structure.\n\nOne way to improve clarity is to use a BDD testing framework\n(eg. `Behave `_,\n`Mamba `_, `Rspec `_), but\nit's not always desirable to restructure existing test and program code.\n\nThere are some pytest plugins that attempt to bridge this gap, by providing\nalternative ways to structure the tests (eg. `pytest-describe\n`_, `pytest-bdd `_), or\naltering the test report output (eg. `pytest-testdox `_), `pytest-pspec `_).\n\n``pytest-it`` takes a similar approach to ``pytest-testdox``, by providing pytest\nmarkers that can describe the test output. ``pytest-it`` supports a few other\nfeatures, such as:\n\n- A plaintext test structure that can easily be copied to markdown/org-mode documents.\n- Arbitrary nesting of ``describe`` and ``context`` markers.\n- Supporting the ``--collect-only`` pytest flag to display test structure.\n- Displaying the full path to each test if ``-v`` is used.\n- Neatly integrating tests in the output if they don't use the ``pytest-it``\n markers.\n\nAlthough ``pytest-it`` does not change the behaviour of pytest tests, you may find it\na useful tool for thinking about test structure, and communicating the intention\nof both the test code and the system under test.\n\n.. |PyPI| image:: https://img.shields.io/pypi/v/pytest-it.svg\n :target: https://pypi.python.org/pypi/pytest-it\n\n.. |Travis| image:: https://travis-ci.org/mattduck/pytest-it.svg?branch=master\n :target: https://travis-ci.org/mattduck/pytest-it", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mattduck/pytest-it", "keywords": "pytest,pytest-it,test,bdd,rspec,org-mode,markdown", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pytest-it", "package_url": "https://pypi.org/project/pytest-it/", "platform": "", "project_url": "https://pypi.org/project/pytest-it/", "project_urls": { "Homepage": "https://github.com/mattduck/pytest-it" }, "release_url": "https://pypi.org/project/pytest-it/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "Pytest plugin to display test reports as a plaintext spec, inspired by Rspec: https://github.com/mattduck/pytest-it.", "version": "0.1.2" }, "last_serial": 5562923, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1fe1b63fb807ba7e99f529719e096c60", "sha256": "99f2af11b6f08f137baff950d9fb3b5795d76785744b8f1a3fe6714aeaf7eccb" }, "downloads": -1, "filename": "pytest-it-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1fe1b63fb807ba7e99f529719e096c60", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6824, "upload_time": "2019-07-14T19:50:18", "url": "https://files.pythonhosted.org/packages/3e/04/063033d2bafa00a9ebe848afa2bf53f0342f9ef13e87c49b4fdba4283fdc/pytest-it-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6c086a0b936c9cae2e9458cb7cfbf8fa", "sha256": "5c093b581f04e64d6093010a4335ae1c497fe297cd60f1badc9347dd1102a6b3" }, "downloads": -1, "filename": "pytest-it-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6c086a0b936c9cae2e9458cb7cfbf8fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7804, "upload_time": "2019-07-20T20:52:26", "url": "https://files.pythonhosted.org/packages/ae/d4/c57daeba28e45d5c2a305fe0778d65a8b2891daafc338ea9eaa41b024f73/pytest-it-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "4e8ab0d4ce2af487e0319e7acd82b40c", "sha256": "daed0bfeec566916a3f1c6563c634f89e017f3243ac1799347c82807df0f4120" }, "downloads": -1, "filename": "pytest-it-0.1.2.tar.gz", "has_sig": false, "md5_digest": "4e8ab0d4ce2af487e0319e7acd82b40c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7256, "upload_time": "2019-07-21T09:54:21", "url": "https://files.pythonhosted.org/packages/fd/f5/b41c70fc0a66addaa03b448e641ccf5ea8fb1398b35dc947b404724ad2be/pytest-it-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4e8ab0d4ce2af487e0319e7acd82b40c", "sha256": "daed0bfeec566916a3f1c6563c634f89e017f3243ac1799347c82807df0f4120" }, "downloads": -1, "filename": "pytest-it-0.1.2.tar.gz", "has_sig": false, "md5_digest": "4e8ab0d4ce2af487e0319e7acd82b40c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7256, "upload_time": "2019-07-21T09:54:21", "url": "https://files.pythonhosted.org/packages/fd/f5/b41c70fc0a66addaa03b448e641ccf5ea8fb1398b35dc947b404724ad2be/pytest-it-0.1.2.tar.gz" } ] }