{ "info": { "author": "Brodie Rao", "author_email": "brodie@bitheap.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Programming Language :: Unix Shell", "Topic :: Software Development :: Testing" ], "description": "======================\r\n Cram: It's test time\r\n======================\r\n\r\nCram is a functional testing framework for command line applications.\r\nCram tests look like snippets of interactive shell sessions. Cram runs\r\neach command and compares the command output in the test with the\r\ncommand's actual output.\r\n\r\nHere's a snippet from `Cram's own test suite`_::\r\n\r\n The $PYTHON environment variable should be set when running this test\r\n from Python.\r\n\r\n $ [ -n \"$PYTHON\" ] || PYTHON=\"`which python`\"\r\n $ [ -n \"$PYTHONPATH\" ] || PYTHONPATH=\"$TESTDIR/..\" && export PYTHONPATH\r\n $ if [ -n \"$COVERAGE\" ]; then\r\n > coverage erase\r\n > alias cram=\"`which coverage` run --branch -a $TESTDIR/../scripts/cram\"\r\n > else\r\n > alias cram=\"$PYTHON $TESTDIR/../scripts/cram\"\r\n > fi\r\n $ command -v md5 > /dev/null || alias md5=md5sum\r\n\r\n Usage:\r\n\r\n $ cram -h\r\n [Uu]sage: cram \\[OPTIONS\\] TESTS\\.\\.\\. (re)\r\n\r\n [Oo]ptions: (re)\r\n -h, --help show this help message and exit\r\n -V, --version show version information and exit\r\n -q, --quiet don't print diffs\r\n -v, --verbose show filenames and test status\r\n -i, --interactive interactively merge changed test output\r\n -d, --debug write script output directly to the terminal\r\n -y, --yes answer yes to all questions\r\n -n, --no answer no to all questions\r\n -E, --preserve-env don't reset common environment variables\r\n --keep-tmpdir keep temporary directories\r\n --shell=PATH shell to use for running tests (default: /bin/sh)\r\n --shell-opts=OPTS arguments to invoke shell with\r\n --indent=NUM number of spaces to use for indentation (default: 2)\r\n --xunit-file=PATH path to write xUnit XML output\r\n\r\nThe format in a nutshell:\r\n\r\n* Cram tests use the ``.t`` file extension.\r\n\r\n* Lines beginning with two spaces, a dollar sign, and a space are run\r\n in the shell.\r\n\r\n* Lines beginning with two spaces, a greater than sign, and a space\r\n allow multi-line commands.\r\n\r\n* All other lines beginning with two spaces are considered command\r\n output.\r\n\r\n* Output lines ending with a space and the keyword ``(re)`` are\r\n matched as `Perl-compatible regular expressions`_.\r\n\r\n* Lines ending with a space and the keyword ``(glob)`` are matched\r\n with a glob-like syntax. The only special characters supported are\r\n ``*`` and ``?``. Both characters can be escaped using ``\\``, and the\r\n backslash can be escaped itself.\r\n\r\n* Output lines ending with either of the above keywords are always\r\n first matched literally with actual command output.\r\n\r\n* Lines ending with a space and the keyword ``(no-eol)`` will match\r\n actual output that doesn't end in a newline.\r\n\r\n* Actual output lines containing unprintable characters are escaped\r\n and suffixed with a space and the keyword ``(esc)``. Lines matching\r\n unprintable output must also contain the keyword.\r\n\r\n* Anything else is a comment.\r\n\r\n.. _Cram's own test suite: https://bitbucket.org/brodie/cram/src/0.6/tests/cram.t\r\n.. _Perl-compatible regular expressions: https://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions\r\n\r\n\r\nDownload\r\n--------\r\n\r\n* `cram-0.7.tar.gz`_ (32 KB, requires Python 2.4-2.7 or Python 3.1 or newer)\r\n\r\n.. _cram-0.7.tar.gz: https://bitheap.org/cram/cram-0.7.tar.gz\r\n\r\n\r\nInstallation\r\n------------\r\n\r\nInstall Cram using make::\r\n\r\n $ wget https://bitheap.org/cram/cram-0.7.tar.gz\r\n $ tar zxvf cram-0.7.tar.gz\r\n $ cd cram-0.7\r\n $ make install\r\n\r\n\r\nUsage\r\n-----\r\n\r\nCram will print a dot for each passing test. If a test fails, a\r\n`unified context diff`_ is printed showing the test's expected output\r\nand the actual output. Skipped tests (empty tests and tests that exit\r\nwith return code ``80``) are marked with ``s`` instead of a dot.\r\n\r\nFor example, if we run Cram on `its own example tests`_::\r\n\r\n .s.!\r\n --- examples/fail.t\r\n +++ examples/fail.t.err\r\n @@ -3,21 +3,22 @@\r\n $ echo 1\r\n 1\r\n $ echo 1\r\n - 2\r\n + 1\r\n $ echo 1\r\n 1\r\n\r\n Invalid regex:\r\n\r\n $ echo 1\r\n - +++ (re)\r\n + 1\r\n\r\n Offset regular expression:\r\n\r\n $ printf 'foo\\nbar\\nbaz\\n\\n1\\nA\\n@\\n'\r\n foo\r\n + bar\r\n baz\r\n\r\n \\d (re)\r\n [A-Z] (re)\r\n - #\r\n + @\r\n s.\r\n # Ran 6 tests, 2 skipped, 1 failed.\r\n\r\nCram will also write the test with its actual output to\r\n``examples/fail.t.err``, allowing you to use other diff tools. This\r\nfile is automatically removed the next time the test passes.\r\n\r\nWhen you're first writing a test, you might just write the commands\r\nand run the test to see what happens. If you run Cram with ``-i`` or\r\n``--interactive``, you'll be prompted to merge the actual output back\r\ninto the test. This makes it easy to quickly prototype new tests.\r\n\r\nYou can specify a default set of options by creating a ``.cramrc``\r\nfile. For example::\r\n\r\n [cram]\r\n verbose = True\r\n indent = 4\r\n\r\nIs the same as invoking Cram with ``--verbose`` and ``--indent=4``.\r\n\r\nTo change what configuration file Cram loads, you can set the\r\n``CRAMRC`` environment variable. You can also specify command line\r\noptions in the ``CRAM`` environment variable.\r\n\r\nNote that the following environment variables are reset before tests\r\nare run:\r\n\r\n* ``TMPDIR``, ``TEMP``, and ``TMP`` are set to the test runner's\r\n ``tmp`` directory.\r\n\r\n* ``LANG``, ``LC_ALL``, and ``LANGUAGE`` are set to ``C``.\r\n\r\n* ``TZ`` is set to ``GMT``.\r\n\r\n* ``COLUMNS`` is set to ``80``. (Note: When using ``--shell=zsh``,\r\n this cannot be reset. It will reflect the actual terminal's width.)\r\n\r\n* ``CDPATH`` and ``GREP_OPTIONS`` are set to an empty string.\r\n\r\nCram also provides the following environment variables to tests:\r\n\r\n* ``CRAMTMP``, set to the test runner's temporary directory.\r\n\r\n* ``TESTDIR``, set to the directory containing the test file.\r\n\r\n* ``TESTFILE``, set to the basename of the current test file.\r\n\r\n* ``TESTSHELL``, set to the value specified by ``--shell``.\r\n\r\nAlso note that care should be taken with commands that close the test\r\nshell's ``stdin``. For example, if you're trying to invoke ``ssh`` in\r\na test, try adding the ``-n`` option to prevent it from closing\r\n``stdin``. Similarly, if you invoke a daemon process that inherits\r\n``stdout`` and fails to close it, it may cause Cram to hang while\r\nwaiting for the test shell's ``stdout`` to be fully closed.\r\n\r\n.. _unified context diff: https://en.wikipedia.org/wiki/Diff#Unified_format\r\n.. _its own example tests: https://bitbucket.org/brodie/cram/src/default/examples/\r\n\r\n\r\nDevelopment\r\n-----------\r\n\r\nDownload the official development repository using Mercurial_::\r\n\r\n hg clone https://bitbucket.org/brodie/cram\r\n\r\nOr Git_::\r\n\r\n git clone https://github.com/brodie/cram.git\r\n\r\nTest Cram using Cram::\r\n\r\n pip install -r requirements.txt\r\n make test\r\n\r\nVisit Bitbucket_ or GitHub_ if you'd like to fork the project, watch\r\nfor new changes, or report issues.\r\n\r\n.. _Mercurial: http://mercurial.selenic.com/\r\n.. _Git: http://git-scm.com/\r\n.. _coverage.py: http://nedbatchelder.com/code/coverage/\r\n.. _Bitbucket: https://bitbucket.org/brodie/cram\r\n.. _GitHub: https://github.com/brodie/cram", "description_content_type": null, "docs_url": null, "download_url": "https://bitheap.org/cram/cram-0.7.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitheap.org/cram/", "keywords": "automatic functional test framework", "license": "GNU GPLv2 or any later version", "maintainer": "", "maintainer_email": "", "name": "cram", "package_url": "https://pypi.org/project/cram/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cram/", "project_urls": { "Download": "https://bitheap.org/cram/cram-0.7.tar.gz", "Homepage": "https://bitheap.org/cram/" }, "release_url": "https://pypi.org/project/cram/0.7/", "requires_dist": null, "requires_python": null, "summary": "A simple testing framework for command line applications", "version": "0.7" }, "last_serial": 1974013, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "c124d1a97aeaac79a2e68351ec02df56", "sha256": "719d06655096d4d4ae567d0bb53e23306652c9143b9f894811dbfe994e589e74" }, "downloads": -1, "filename": "cram-0.1.tar.gz", "has_sig": false, "md5_digest": "c124d1a97aeaac79a2e68351ec02df56", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12756, "upload_time": "2010-09-19T07:28:39", "url": "https://files.pythonhosted.org/packages/3c/29/aa2a91cb1dccf7e1587553abd5dc8fe0cf07ba95c3966965b8a108cd0037/cram-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "d135001d26b66575497100972a9e589e", "sha256": "0000caf8511ef5589dccd9e60e1f083243972c6e2d779eaa98fb376c1690a121" }, "downloads": -1, "filename": "cram-0.2.tar.gz", "has_sig": false, "md5_digest": "d135001d26b66575497100972a9e589e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13234, "upload_time": "2010-09-19T09:29:30", "url": "https://files.pythonhosted.org/packages/19/77/623a1221a7997d50b50fa8a89ddfcb52d4dfe99f3400f9567d499d46f75a/cram-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "b50dce12b4ff91b756b977037f6e29ec", "sha256": "338b6dc2df0a8a1381c4460a3741092783adc36dad782ee83b3d3acd75593670" }, "downloads": -1, "filename": "cram-0.3.tar.gz", "has_sig": false, "md5_digest": "b50dce12b4ff91b756b977037f6e29ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15622, "upload_time": "2010-09-20T00:58:03", "url": "https://files.pythonhosted.org/packages/80/35/6adc0f044da3ada73be70fc9b1777019f174f2b9356fd6d9ed345f41eb71/cram-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "d6aa193ba481ba6f12034dfe8fc78a46", "sha256": "81770ddc9122dcb08789e4f8e5795a8d24e7c9a1523a6d03e179e812d8f08de7" }, "downloads": -1, "filename": "cram-0.4.tar.gz", "has_sig": false, "md5_digest": "d6aa193ba481ba6f12034dfe8fc78a46", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20115, "upload_time": "2010-09-28T08:39:48", "url": "https://files.pythonhosted.org/packages/2a/dc/4ff283d4eaadc3aa417fd7a3e3096a33cd245187cc237da2755aff75aea6/cram-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "9e80a3b4204c6772a8f91e69fbfe8037", "sha256": "edec7337c11f085cc166b3c6c18ed0098a61c9be8d6a5fc048a9c2c0242f17eb" }, "downloads": -1, "filename": "cram-0.5.tar.gz", "has_sig": true, "md5_digest": "9e80a3b4204c6772a8f91e69fbfe8037", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22205, "upload_time": "2013-03-31T00:33:40", "url": "https://files.pythonhosted.org/packages/09/b8/40538a297eea83698b8df4767b9d76cdb4954e77039ac71623060dd53b57/cram-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "ede2b4bd72def756a35f8b197175b77e", "sha256": "d19451373530b726c83775a6359f177fcd59c884a9264039d9cbd3c14677cdc4" }, "downloads": -1, "filename": "cram-0.6-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "ede2b4bd72def756a35f8b197175b77e", "packagetype": "bdist_wheel", "python_version": "any", "requires_python": null, "size": 17004, "upload_time": "2014-01-27T08:13:44", "url": "https://files.pythonhosted.org/packages/a6/5d/6ccd9e8af3221ab4dc362375d1ec6ca5a99e6aaa0d1f56f27c5446d8f3db/cram-0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3808e3e7812c68ca962c4db9abac9069", "sha256": "5508187940cf6acafa9538446c007428e7ebd413c17b5320505f08fa0bf267ca" }, "downloads": -1, "filename": "cram-0.6.tar.gz", "has_sig": true, "md5_digest": "3808e3e7812c68ca962c4db9abac9069", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24433, "upload_time": "2013-08-01T22:22:06", "url": "https://files.pythonhosted.org/packages/96/37/1d3c976bbc158beab3966fc9d41eca4d708257efa105f1c54433a409b323/cram-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "cce1d748831f0b46a462bcb7000a0a5f", "sha256": "008e4e8b4d325cf040964b5f62460535b004a7bc816d54f8527a4d299edfe4a3" }, "downloads": -1, "filename": "cram-0.7-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "cce1d748831f0b46a462bcb7000a0a5f", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 22141, "upload_time": "2016-02-24T10:29:55", "url": "https://files.pythonhosted.org/packages/a2/09/c119252f12b35c21b030c01d38d292936660c167e725ce07517fae2b01a0/cram-0.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2ea37ada5190526b9bcaac5e4099221c", "sha256": "7da7445af2ce15b90aad5ec4792f857cef5786d71f14377e9eb994d8b8337f2f" }, "downloads": -1, "filename": "cram-0.7.tar.gz", "has_sig": true, "md5_digest": "2ea37ada5190526b9bcaac5e4099221c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33527, "upload_time": "2016-02-24T10:29:44", "url": "https://files.pythonhosted.org/packages/38/85/5a8a3397b2ccb2ffa3ba871f76a4d72c16531e43d0e58fc89a0f2983adbd/cram-0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cce1d748831f0b46a462bcb7000a0a5f", "sha256": "008e4e8b4d325cf040964b5f62460535b004a7bc816d54f8527a4d299edfe4a3" }, "downloads": -1, "filename": "cram-0.7-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "cce1d748831f0b46a462bcb7000a0a5f", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 22141, "upload_time": "2016-02-24T10:29:55", "url": "https://files.pythonhosted.org/packages/a2/09/c119252f12b35c21b030c01d38d292936660c167e725ce07517fae2b01a0/cram-0.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2ea37ada5190526b9bcaac5e4099221c", "sha256": "7da7445af2ce15b90aad5ec4792f857cef5786d71f14377e9eb994d8b8337f2f" }, "downloads": -1, "filename": "cram-0.7.tar.gz", "has_sig": true, "md5_digest": "2ea37ada5190526b9bcaac5e4099221c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33527, "upload_time": "2016-02-24T10:29:44", "url": "https://files.pythonhosted.org/packages/38/85/5a8a3397b2ccb2ffa3ba871f76a4d72c16531e43d0e58fc89a0f2983adbd/cram-0.7.tar.gz" } ] }