{ "info": { "author": "Michael Delgado", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "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.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "=======================================\r\nClatter Command Line Application Tester\r\n=======================================\r\n\r\n.. image:: https://img.shields.io/pypi/v/clatter.svg\r\n :target: https://pypi.python.org/pypi/clatter\r\n\r\n.. image:: https://travis-ci.org/delgadom/clatter.svg?branch=master\r\n :target: https://travis-ci.org/delgadom/clatter?branch=master\r\n\r\n.. image:: https://coveralls.io/repos/github/delgadom/clatter/badge.svg?branch=master\r\n :target: https://coveralls.io/github/delgadom/clatter?branch=master\r\n\r\n.. image:: https://readthedocs.org/projects/clatter/badge/?version=latest\r\n :target: https://clatter.readthedocs.io/en/latest/?badge=latest\r\n :alt: Documentation Status\r\n\r\n.. image:: https://pyup.io/repos/github/delgadom/clatter/shield.svg\r\n :target: https://pyup.io/repos/github/delgadom/clatter/\r\n :alt: Updates\r\n\r\n.. image:: https://api.codacy.com/project/badge/Grade/2c2af36490c04543b925edafc0d66842\r\n :target: https://www.codacy.com/app/delgadom/clatter?utm_source=github.com&utm_medium=referral&utm_content=delgadom/clatter&utm_campaign=Badge_Grade\r\n\r\n.. image:: https://img.shields.io/pypi/pyversions/clatter.svg\r\n :target: https://pypi.python.org/pypi/clatter\r\n\r\n\r\nclatter is a doctest-style testing tool for command-line applications. It wraps other testing suites and allows them to be tested in docstrings.\r\n\r\n* Free software: MIT license\r\n* Documentation: https://clatter.readthedocs.io.\r\n\r\n\r\nFeatures\r\n--------\r\n\r\n* Bring testing best practices to your command line apps\r\n* Extensible - subclassing CommandValidator is trivial using any cli testing suite\r\n* Easily test your documentation. This README is a valid doctest!\r\n\r\n\r\nUsage\r\n-----\r\n\r\n.. code-block:: python\r\n\r\n >>> from clatter import Runner\r\n >>> from clatter.validators import SubprocessValidator\r\n\r\nTest command line utilities and applications by whitelisting them with app-specific testing engines:\r\n\r\n.. code-block:: python\r\n\r\n >>> test_str = r'''\r\n ... \r\n ... .. code-block:: bash\r\n ... \r\n ... $ echo 'Pining for the fjords'\r\n ... Pining for the fjords\r\n ... '''\r\n >>>\r\n >>> tester = Runner()\r\n >>> tester.call_engines['echo'] = SubprocessValidator()\r\n >>> tester.teststring(test_str)\r\n\r\nClick applications\r\n~~~~~~~~~~~~~~~~~~\r\n\r\nIntegrate your command line app:\r\n\r\n.. code-block:: python\r\n\r\n >>> import click\r\n >>> @click.command()\r\n ... @click.argument('name')\r\n ... def hello(name):\r\n ... click.echo('Hello %s!' % name)\r\n\r\nThis can now be tested in docstrings:\r\n\r\n.. code-block:: python\r\n\r\n >>> test_str = '''\r\n ... \r\n ... .. code-block:: bash\r\n ... \r\n ... $ hello Polly\r\n ... Hello Polly!\r\n ... \r\n ... $ hello Polly Parrot\r\n ... Usage: hello [OPTIONS] NAME\r\n ... \r\n ... Error: Got unexpected extra argument (Parrot)\r\n ... \r\n ... $ hello 'Polly Parrot'\r\n ... Hello Polly Parrot!\r\n ... \r\n ... '''\r\n\r\nClick applications can be tested with a ``ClickValidator`` engine:\r\n\r\n.. code-block:: python\r\n\r\n >>> from clatter.validators import ClickValidator\r\n >>> tester = Runner()\r\n >>> tester.call_engines['hello'] = ClickValidator(hello)\r\n\r\n >>> tester.teststring(test_str)\r\n\r\n\r\nMixed applications\r\n~~~~~~~~~~~~~~~~~~\r\n\r\nYour app can be combined with other command-line utilities by adding multiple engines:\r\n\r\n.. code-block:: python\r\n\r\n >>> test_str = r'''\r\n ... \r\n ... .. code-block:: bash\r\n ... \r\n ... $ hello Polly\r\n ... Hello Polly!\r\n ... \r\n ... $ echo 'Pining for the fjords'\r\n ... Pining for the fjords\r\n ... \r\n ... Pipes/redirects don't work, so we can't redirect this value into a file.\r\n ... But we can write a file with python:\r\n ... \r\n ... .. code-block:: bash\r\n ... \r\n ... $ python -c \\\r\n ... > \"with open('tmp.txt', 'w+') as f: f.write('Pushing up daisies')\"\r\n ... \r\n ... $ cat tmp.txt\r\n ... Pushing up daisies\r\n ...\r\n ... '''\r\n\r\n >>> tester.call_engines['echo'] = SubprocessValidator()\r\n >>> tester.call_engines['python'] = SubprocessValidator()\r\n >>> tester.call_engines['cat'] = SubprocessValidator()\r\n\r\n >>> tester.teststring(test_str)\r\n\r\nSuppressing commands\r\n~~~~~~~~~~~~~~~~~~~~\r\n\r\nCommands can be skipped altogether with a ``SkipValidator``:\r\n\r\n.. code-block:: python\r\n\r\n >>> test_str = '''\r\n ... .. code-block:: bash\r\n ... \r\n ... $ aws storage buckets list\r\n ... \r\n ... '''\r\n\r\n >>> from clatter.validators import SkipValidator\r\n >>> tester.call_engines['aws'] = SkipValidator()\r\n\r\n >>> tester.teststring(test_str)\r\n\r\n\r\nIllegal commands\r\n~~~~~~~~~~~~~~~~\r\n\r\nErrors are raised when using an application you haven't whitelisted:\r\n\r\n.. code-block:: python\r\n\r\n >>> test_str = '''\r\n ...\r\n ... The following block of code should cause an error:\r\n ...\r\n ... .. code-block:: bash\r\n ...\r\n ... $ rm tmp.txt\r\n ...\r\n ... '''\r\n\r\n >>> tester.teststring(test_str) # doctest +ELLIPSIS\r\n Traceback (most recent call last):\r\n ...\r\n ValueError: Command \"rm\" not allowed. Add command caller to call_engines to whitelist.\r\n\r\nUnrecognized commands will not raise an error if +SKIP is specified\r\n\r\n.. doctest's skip here will be interpreted by doctest, not clatter. So we mock the code here.\r\n\r\n >>> test_str = r'''\r\n ...\r\n ... .. code-block:: bash\r\n ...\r\n ... $ nmake all # doctest\r\n ... $ echo 'I made it!'\r\n ... I made it!\r\n ...\r\n ... '''\r\n >>> test_str = test_str.replace('ctest', 'ctest: +SKIP')\r\n\r\n.. code-block:: python\r\n\r\n >>> test_str = r'''\r\n ...\r\n ... .. code-block:: bash\r\n ...\r\n ... $ nmake all # doctest: +SKIP\r\n ... $ echo 'I made it!'\r\n ... I made it!\r\n ...\r\n ... '''\r\n >>> tester.teststring(test_str)\r\n\r\nError handling\r\n~~~~~~~~~~~~~~\r\n\r\nLines failing to match the command's output will raise an error\r\n\r\n.. code-block:: python\r\n\r\n >>> test_str = r'''\r\n ... .. code-block:: bash\r\n ... \r\n ... $ echo \"There, it moved!\"\r\n ... \"No it didn't!\"\r\n ... \r\n ... '''\r\n\r\n >>> tester = Runner()\r\n >>> tester.call_engines['echo'] = SubprocessValidator()\r\n\r\n >>> tester.teststring(test_str) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE\r\n Traceback (most recent call last):\r\n ...\r\n ValueError: Clatter test failed. There, it moved!\r\n != \"No it didn't!\"\r\n + There, it moved!\r\n - \"No it didn't!\"\r\n\r\nKnown issues\r\n------------\r\n\r\nWe have issues on our `issues `_ page. But we want to be very up-front about these.\r\n\r\nSecurity\r\n~~~~~~~~\r\n\r\nSimilar to ``doctest``, executing arbitrary commands from within your tests is dangerous, and we make no attempt to protect you. We won't run commands you don't whitelist, but we cant't prevent against malicious cases. Don't run anything you don't understand, and use at your own risk.\r\n\r\nSyntactic completeness\r\n~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nClatter is not a syntactically complete bash emulator and has no intention of being so.\r\n\r\nAll arguments to commands are passed as arguments to the first command. Therefore, loops, pipes, redirects, and other control-flow and IO commands will not work as expected.\r\n\r\n.. code-block:: python\r\n\r\n >>> test_str = '''\r\n ... $ echo hello > test.txt\r\n ... $ cat test.txt \r\n ... hello\r\n ...\r\n ... '''\r\n >>> tester.teststring(test_str) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE\r\n Traceback (most recent call last):\r\n ...\r\n ValueError: Clatter test failed. hello > test.txt\r\n != \r\n + hello > test.txt\r\n - \r\n\r\n\r\n\r\nInstallation\r\n------------\r\n\r\n``pip install clatter``\r\n\r\n\r\nRequirements\r\n------------\r\n\r\n* pytest\r\n\r\n\r\nTodo\r\n----\r\n\r\nSee `issues `_ to see and add to our todos.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/delgadom/clatter", "keywords": "clatter", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "clatter", "package_url": "https://pypi.org/project/clatter/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/clatter/", "project_urls": { "Homepage": "https://github.com/delgadom/clatter" }, "release_url": "https://pypi.org/project/clatter/0.1.1/", "requires_dist": [ "click (>=6.0)", "Sphinx (>=1.4.1); extra == 'test'", "click (>=6.0); extra == 'test'", "coverage (>=4.0); extra == 'test'", "flake8 (>=2.0); extra == 'test'", "jinja2 (>=2.8); extra == 'test'", "pip (>=8.0); extra == 'test'", "pytest (>=3.0); extra == 'test'", "pytest-cov (>=2.0); extra == 'test'", "pytest-runner (>=2.5); extra == 'test'", "sphinx-rtd-theme (>=0.1.0); extra == 'test'", "tox (>=2.3.0); extra == 'test'", "wheel (>=0.27); extra == 'test'" ], "requires_python": "", "summary": "A Doctest-stype Command Line Application Tester", "version": "0.1.1" }, "last_serial": 2639933, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "a9889989a6dd4f9100f36198df00544d", "sha256": "64999f86772a2167e44608adf1c263aed43d161eab215bb7b349c75ca42e242a" }, "downloads": -1, "filename": "clatter-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a9889989a6dd4f9100f36198df00544d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7738, "upload_time": "2017-02-11T06:46:28", "url": "https://files.pythonhosted.org/packages/6f/7c/ecd062a4108ebd236cd8feb7c3c8d72ed75b22a072987a274770ee031d34/clatter-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "49b68939875e5b4d60999088ab815a62", "sha256": "e7f016f724ae4d50a9a2bf98805accc06e4ae572eb4e9f4b8b8cc8045cf201c1" }, "downloads": -1, "filename": "clatter-0.0.2.tar.gz", "has_sig": false, "md5_digest": "49b68939875e5b4d60999088ab815a62", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6637, "upload_time": "2017-02-11T06:46:31", "url": "https://files.pythonhosted.org/packages/a7/d3/0eb358c75352183d0fa91bec6af251c7392ce6a32c0bd718314e7fd711dd/clatter-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "9006bd325c8035d6c8c30593832ff11b", "sha256": "492d933ec9aa6f77fff1e65139f86cf7e1063eee4c034978f0e36dea001f700b" }, "downloads": -1, "filename": "clatter-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9006bd325c8035d6c8c30593832ff11b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8041, "upload_time": "2017-02-11T11:29:23", "url": "https://files.pythonhosted.org/packages/40/9d/b23d5b42185f8973e2ca4373324f8b88669530c909429b05a0bdde76705e/clatter-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1ad17b00cec7f2c3c8091ba8b61760db", "sha256": "0896cb4c561ef28ff1ce3e55d217be89847bb197fdc9122cf10b2a23a4aadd67" }, "downloads": -1, "filename": "clatter-0.0.3.tar.gz", "has_sig": false, "md5_digest": "1ad17b00cec7f2c3c8091ba8b61760db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6802, "upload_time": "2017-02-11T11:29:26", "url": "https://files.pythonhosted.org/packages/b4/80/2041d48bb62648b8e052462a55522297e3f0de10e391e9add9287b6883a6/clatter-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "ebb80214a9fe2add1fcddf6ba722cad2", "sha256": "28518330cc368254b654d227d2d7a4e68b299809f9aa373df5a3178ed73512c6" }, "downloads": -1, "filename": "clatter-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ebb80214a9fe2add1fcddf6ba722cad2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9023, "upload_time": "2017-02-13T07:44:32", "url": "https://files.pythonhosted.org/packages/a4/b5/f6cb9d1c7302caa724678d6be8435b087b2cb823b129447d1cb7a535aea1/clatter-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5b1a06225fd5fb02c84e913fe04d1a6a", "sha256": "f948086eb84e32cf331d9075dab44cc9c5f68c309188aa4a20ff6bf67854cea6" }, "downloads": -1, "filename": "clatter-0.0.4.tar.gz", "has_sig": false, "md5_digest": "5b1a06225fd5fb02c84e913fe04d1a6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22004, "upload_time": "2017-02-13T07:44:35", "url": "https://files.pythonhosted.org/packages/eb/4d/0cf1bc4747271937d79976841aee3073aa39130e2d5cc9aaeb55684812e4/clatter-0.0.4.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "e4fda352f253717f59e07fc02d6cc9ad", "sha256": "5e78312750e6430a5467f3b806a5cf23d2d24db9e2e5032ad3889c59ae41c070" }, "downloads": -1, "filename": "clatter-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e4fda352f253717f59e07fc02d6cc9ad", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9131, "upload_time": "2017-02-13T21:48:34", "url": "https://files.pythonhosted.org/packages/00/6a/c242a9a606930ef782c7aca1bc9343a5aa61cf9d0a969463d51df01f8af3/clatter-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c6c533367d4d6527e4b234f9c07c8193", "sha256": "655bbf6369d7390fdfd3bbb2f5381855eab745a979d3fd6ed22241c427fc15ee" }, "downloads": -1, "filename": "clatter-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c6c533367d4d6527e4b234f9c07c8193", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17163, "upload_time": "2017-02-13T21:48:36", "url": "https://files.pythonhosted.org/packages/6d/a5/7fda04790dd15ee44fdb0d06db66f646bd273e9ed6ffcf05bf7bc025edff/clatter-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "dd797d7ae53d1cfd44966604e974faa9", "sha256": "e6dcda476297d505f3f62254fbdda2e46aed3be7f56979b258faa2a8fb96209a" }, "downloads": -1, "filename": "clatter-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dd797d7ae53d1cfd44966604e974faa9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9330, "upload_time": "2017-02-14T02:42:38", "url": "https://files.pythonhosted.org/packages/25/a1/e57a389060899a0e2e253f290b804211a8f6e1db1dcd8492938d69316ad3/clatter-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9eed8749c7220c5188a1427467245bf1", "sha256": "c43f4f9f297841b9159e99ebcc855960f910b953a79e8dd9afa8cbc8a7b071cf" }, "downloads": -1, "filename": "clatter-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9eed8749c7220c5188a1427467245bf1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17422, "upload_time": "2017-02-14T02:42:40", "url": "https://files.pythonhosted.org/packages/f5/bf/03ca35fe3bd7d47dfacde6618555c3e4672323bee6c16b157fc263eb2601/clatter-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dd797d7ae53d1cfd44966604e974faa9", "sha256": "e6dcda476297d505f3f62254fbdda2e46aed3be7f56979b258faa2a8fb96209a" }, "downloads": -1, "filename": "clatter-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dd797d7ae53d1cfd44966604e974faa9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9330, "upload_time": "2017-02-14T02:42:38", "url": "https://files.pythonhosted.org/packages/25/a1/e57a389060899a0e2e253f290b804211a8f6e1db1dcd8492938d69316ad3/clatter-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9eed8749c7220c5188a1427467245bf1", "sha256": "c43f4f9f297841b9159e99ebcc855960f910b953a79e8dd9afa8cbc8a7b071cf" }, "downloads": -1, "filename": "clatter-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9eed8749c7220c5188a1427467245bf1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17422, "upload_time": "2017-02-14T02:42:40", "url": "https://files.pythonhosted.org/packages/f5/bf/03ca35fe3bd7d47dfacde6618555c3e4672323bee6c16b157fc263eb2601/clatter-0.1.1.tar.gz" } ] }