{ "info": { "author": "Valentin Lab", "author_email": "valentin.lab@kalysto.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Topic :: Software Development", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "=========================\nkids.test\n=========================\n\n.. image:: http://img.shields.io/pypi/v/kids.test.svg?style=flat\n :target: https://pypi.python.org/pypi/kids.test/\n :alt: Latest PyPI version\n\n.. image:: http://img.shields.io/pypi/dm/kids.test.svg?style=flat\n :target: https://pypi.python.org/pypi/kids.test/\n :alt: Number of PyPI downloads\n\n.. image:: http://img.shields.io/travis/0k/kids.test/master.svg?style=flat\n :target: https://travis-ci.org/0k/kids.test/\n :alt: Travis CI build status\n\n.. image:: http://img.shields.io/coveralls/0k/kids.test/master.svg?style=flat\n :target: https://coveralls.io/r/0k/kids.test\n :alt: Test coverage\n\n\n\n``kids.test`` is a Python library providing helpers when writing tests\nin python. It's part of 'Kids' (for Keep It Dead Simple) library.\n\n\nMaturity\n========\n\nThis is alpha release. It's only a repository with a few recipes and holds very\nfew interests. It might be more consistent in the future.\n\nIt lacks any sensible documentation and has nothing ground breaking in its core.\n\n\nFeatures\n========\n\nusing ``kids.test``:\n\n- You can use a replacement ``unittest`` class that ensure that you have some\n python3 additions like ``assertContains`` or ``assertRegex``.\n- You can use ``BaseTmpDirTest`` that creates a temporary directory before\n executing tests, and delete it at the end.\n\n\nInstallation\n============\n\nYou don't need to download the GIT version of the code as ``kids.test`` is\navailable on the PyPI. So you should be able to run::\n\n pip install kids.test\n\nIf you have downloaded the GIT sources, then you could add install\nthe current version via traditional::\n\n python setup.py install\n\nAnd if you don't have the GIT sources but would like to get the latest\nmaster or branch from github, you could also::\n\n pip install git+https://github.com/0k/kids.test\n\nOr even select a specific revision (branch/tag/commit)::\n\n pip install git+https://github.com/0k/kids.test@master\n\n\nUsage\n=====\n\nTest\n----\n\n``Test`` is the base class for all unittest in ``kids.*`` framework. It provides\nsome missing ``.assert*()`` method to python 2::\n\n >>> from kids.test import Test, run\n\n >>> class MyTest(Test):\n ... def test_foo(self):\n ... self.assertRegex('foo', 'fo+')\n ... self.assertContains('bar foo hop', 'foo')\n ... self.assertNotContains('bar fou hop', 'foo')\n ... def test_failing_regex(self):\n ... self.assertRegex('foo', 'xfo+')\n ... def test_failing_contains(self):\n ... self.assertContains('bar fou hop', 'foo')\n ... def test_failing_not_contains(self):\n ... self.assertNotContains('bar foo hop', 'foo')\n\n >>> run(MyTest)\n FFF.\n ...\n AssertionError: ...'bar fou hop' should contain 'foo'.\n ...\n AssertionError: ...'bar foo hop' should not contain 'foo'.\n ...\n AssertionError: ...'foo' should match regex 'xfo+'.\n ...\n Ran 4 tests in ...s\n \n FAILED (failures=3)\n \n\n\nBaseTmpDirTest\n--------------\n\nThis unittest class will ensure that the current work dir (CWD) before\nexecuting test, is an empty temporary directory. And it'll ensure this directory\nwill be deleted at the end::\n\n >>> from kids.test import BaseTmpDirTest, run\n\n >>> class MyTest(BaseTmpDirTest):\n ... def test_foo(self):\n ... import glob\n ... self.assertEqual(len(glob.glob('*')), 0)\n\n >>> run(MyTest)\n .\n ----------------------------------------------------------------------\n Ran 1 test in ...s\n \n OK\n \n\n\nHere's what happens behing the scene, let's use minimock to show the\ncreation and deletion of directory::\n\n >>> import minimock\n\n >>> import tempfile, shutil, os\n\n >>> minimock.mock('tempfile.mkdtemp', returns='/tmp/tempdir')\n >>> minimock.mock('os.chdir', returns='/tmp/tempdir')\n >>> minimock.mock('shutil.rmtree')\n\n >>> class MyTest(BaseTmpDirTest):\n ... def test_foo(self):\n ... print(\"running test\")\n ... self.assertTrue(True)\n\n >>> run(MyTest)\n Called tempfile.mkdtemp()\n Called os.chdir('/tmp/tempdir')\n running test\n Called os.chdir('...')\n Called shutil.rmtree('/tmp/tempdir')\n .\n ----------------------------------------------------------------------\n Ran 1 test in ...s\n \n OK\n \n\n >>> minimock.restore()\n\nContributing\n============\n\nAny suggestion or issue is welcome. Push request are very welcome,\nplease check out the guidelines.\n\n\nPush Request Guidelines\n-----------------------\n\nYou can send any code. I'll look at it and will integrate it myself in\nthe code base and leave you as the author. This process can take time and\nit'll take less time if you follow the following guidelines:\n\n- check your code with PEP8 or pylint. Try to stick to 80 columns wide.\n- separate your commits per smallest concern.\n- each commit should pass the tests (to allow easy bisect)\n- each functionality/bugfix commit should contain the code, tests,\n and doc.\n- prior minor commit with typographic or code cosmetic changes are\n very welcome. These should be tagged in their commit summary with\n ``!minor``.\n- the commit message should follow gitchangelog rules (check the git\n log to get examples)\n- if the commit fixes an issue or finished the implementation of a\n feature, please mention it in the summary.\n\nIf you have some questions about guidelines which is not answered here,\nplease check the current ``git log``, you might find previous commit that\nwould show you how to deal with your issue.\n\n\nLicense\n=======\n\nCopyright (c) 2015 Valentin Lab.\n\nLicensed under the `BSD License`_.\n\n.. _BSD License: http://raw.github.com/0k/kids.test/master/LICENSE\n\nChangelog\n=========\n\n0.0.1 (2015-02-04)\n------------------\n\n- First import. [Valentin Lab]", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/0k/kids.test", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "kids.test", "package_url": "https://pypi.org/project/kids.test/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/kids.test/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/0k/kids.test" }, "release_url": "https://pypi.org/project/kids.test/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "Kids test library.", "version": "0.0.1" }, "last_serial": 1409163, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d4a8923d20824d17d67530ab5c98de4a", "sha256": "a1237f537ee72a4354dca428ad92911d105d3f755a182bbda0b5969523ccf2bb" }, "downloads": -1, "filename": "kids.test-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d4a8923d20824d17d67530ab5c98de4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5462, "upload_time": "2015-02-04T09:57:28", "url": "https://files.pythonhosted.org/packages/c9/6c/8a20919e1fe11a9e502d9b764c150a8349daffbdd77db26da7e6481d3865/kids.test-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d4a8923d20824d17d67530ab5c98de4a", "sha256": "a1237f537ee72a4354dca428ad92911d105d3f755a182bbda0b5969523ccf2bb" }, "downloads": -1, "filename": "kids.test-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d4a8923d20824d17d67530ab5c98de4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5462, "upload_time": "2015-02-04T09:57:28", "url": "https://files.pythonhosted.org/packages/c9/6c/8a20919e1fe11a9e502d9b764c150a8349daffbdd77db26da7e6481d3865/kids.test-0.0.1.tar.gz" } ] }