{ "info": { "author": "Antti Kaihola", "author_email": "antti.kaihola@eniram.fi", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.5" ], "description": "ipython_pytest\n--------------\n\nThis little IPython extension gives you the ability to\nrun tests using Pytest in an IPython Notebook.\n\nThe motivation for the extension was to make it possible to\ndemonstrate test-driven development using pytest in an IPython\nnotebook driven presentation.\n\nThis extension does not attempt to enable using notebooks as test\nsuites. The intention is also not to collect test results from\nmultiple cells, but to do separate test runs for cells in an\ninteractive presentation.\n\nThis extension attempts to achieve for pytest_ what the\nipython_nose_ extension does for nose_. Unfortunately it isn't able\nto inject globals from the notebook environment into the test like the\n``%%nose`` `cell magic in ipython_nose`_. Instead, in\n``ipython_pytest``, all imports, constants and helper functions need\nto be contained in the test cell itself.\n\n.. _pytest: https://pytest.org/\n.. _ipython_nose: https://github.com/taavi/ipython_nose\n.. _cell magic in ipython_nose: https://github.com/taavi/ipython_nose/pull/11/files\n.. _nose: https://nose.readthedocs.io/\n\n\nInstallation\n------------\n\n* Make sure your IPython Notebook server can import ``ipython_pytest.py`` (e.g.\n copy it to a directory in your ``PYTHONPATH``, or modify ``PYTHONPATH``\n before starting IPython Notebook). It's also probably sufficient to have\n ``ipython_pytest.py`` in the directory from which you run the notebook, e.g.::\n\n $ ls\n ipython_pytest.py\n $ ipython notebook\n\n* You can also install it in a virtualenv in developent mode::\n\n $ cd ipython-pytest\n $ pip install -e .\n\n\nUsage\n-----\n\n* Add a cell containing::\n\n %load_ext ipython_pytest\n\n somewhere in your notebook.\n\n* Write tests that conform to Pytest conventions, e.g.::\n\n def test_arithmetic():\n assert 1+1 == 2\n\n* Add a cell consisting of::\n\n %%pytest\n\n def test_my_stuff():\n assert 42 == 42\n\n to your notebook and run that cell. That will discover your\n ``test_*`` functions, run them, and show console output from\n Pytest.\n\n* Pass standard Pytest arguments to the magic::\n\n %%pytest --tb=short\n\n\nCaveats\n-------\n\n* None of the objects defined in other cells of the notebook are available\n in the test cell.\n\n\nAuthors\n-------\n\n* Antti Kaihola \n\n\nOther similar tools\n-------------------\n\nThanks to Taavi Burns for the idea in his ipython_nose_ package.\n\nChristopher Prohm has created the ipytest_ package for running pytest and\nunittest tests in IPython notebooks.\n\n.. _ipytest: https://github.com/chmp/ipytest\n\n\nGet the code\n------------\n\n::\n\n git clone https://github.com/akaihola/ipython_pytest.git\n\n\nCopyright\n---------\n\nCopyright (c) 2016, Antti Kaihola.\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright notice, this\nlist of conditions and the following disclaimer in the documentation and/or\nother materials provided with the distribution.\n\nNeither the name of the developers nor the names of contributors may\nbe used to endorse or promote products derived from this software\nwithout specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/akaihola/ipython_pytest", "keywords": "", "license": "README.rst", "maintainer": "", "maintainer_email": "", "name": "ipython_pytest", "package_url": "https://pypi.org/project/ipython_pytest/", "platform": "", "project_url": "https://pypi.org/project/ipython_pytest/", "project_urls": { "Homepage": "https://github.com/akaihola/ipython_pytest" }, "release_url": "https://pypi.org/project/ipython_pytest/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "IPython extension to run pytest for the current cell.", "version": "0.0.1" }, "last_serial": 3882531, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "019266d839de9a87e90402f8ae9cbd39", "sha256": "986f1859f3881c7c9f3104074889fb6f6a9bbcae59c46fe1b582b73db8dc4040" }, "downloads": -1, "filename": "ipython_pytest-0.0.1.tar.gz", "has_sig": false, "md5_digest": "019266d839de9a87e90402f8ae9cbd39", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3487, "upload_time": "2018-05-21T08:08:05", "url": "https://files.pythonhosted.org/packages/de/41/27fd955cca43bbbb546959b77bd5757495ffb2ca3cb08fc6b0cce6c366c8/ipython_pytest-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "019266d839de9a87e90402f8ae9cbd39", "sha256": "986f1859f3881c7c9f3104074889fb6f6a9bbcae59c46fe1b582b73db8dc4040" }, "downloads": -1, "filename": "ipython_pytest-0.0.1.tar.gz", "has_sig": false, "md5_digest": "019266d839de9a87e90402f8ae9cbd39", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3487, "upload_time": "2018-05-21T08:08:05", "url": "https://files.pythonhosted.org/packages/de/41/27fd955cca43bbbb546959b77bd5757495ffb2ca3cb08fc6b0cce6c366c8/ipython_pytest-0.0.1.tar.gz" } ] }