{ "info": { "author": "Yann Kaiser", "author_email": "kaiser.yann@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing" ], "description": ".. |ut| replace:: unittest\n.. _ut: http://docs.python.org/3/library/unittest.html\n\n.. |tc| replace:: unittest.TestCase\n.. _tc: http://docs.python.org/3/library/unittest.html#unittest.TestCase\n\n.. _repated_test:\n\n*************\nrepeated_test\n*************\n\n.. image:: https://badges.gitter.im/epsy/repeated_test.svg\n :alt: Join the chat at https://gitter.im/epsy/repeated_test\n :target: https://gitter.im/epsy/repeated_test?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n.. image:: https://travis-ci.org/epsy/repeated_test.svg?branch=master\n :target: https://travis-ci.org/epsy/repeated_test\n.. image:: https://coveralls.io/repos/github/epsy/repeated_test/badge.svg?branch=master\n :target: https://coveralls.io/github/epsy/repeated_test?branch=master\n\n``repeated_test`` lets you nicely write tests that apply the same function to\nmany sets of parameters.\n\n\n.. _example:\n\nFor instance:\n\n.. code-block:: python\n\n from repeated_test import Fixtures\n\n class my_fixtures(Fixtures):\n def _test(self, expected, *terms):\n self.assertEqual(expected, sum(terms))\n\n a = 10, 5, 5\n b = 15, 7, 8\n c = 42, 1, 1\n\nThe result is unittest-compatible, and provides useful context in the\ntraceback in case of errors:\n\n.. code-block:: console\n\n $ python -m unittest my_tests\n ..F\n ======================================================================\n FAIL: test_c (my_tests.my_fixtures)\n ----------------------------------------------------------------------\n Traceback (most recent call last):\n File \"my_tests.py\", line 9, in my_fixtures\n c = 42, 1, 1\n File \"my_tests.py\", line 5, in _test\n self.assertEqual(expected, sum(terms))\n AssertionError: 42 != 2\n\n ----------------------------------------------------------------------\n Ran 3 tests in 0.002s\n\n FAILED (failures=1)\n\n.. _install:\n\nYou can install it using:\n\n.. code-block:: console\n\n $ pip install --user repeated_test\n\n\n.. _help:\n\nHelp / Issues\n=============\n\nYou can get help in the\n`gitter.im chatroom `_.\n\nIf you find any issues or have any requests, use\n`GitHub Issues `_.\n\n\n.. _reference:\n\nReference\n=========\n\n.. _intro:\n\nIntroduction\n------------\n\nPython's |ut|_ modules helps in performing various forms of automated testing.\nOne writes a class deriving from |tc|_ and adds various ``test_xyz`` methods,\nand test runners run these tests, keeping count of succesful tests, failed\ntests and produces a trace of the causes of these failures.\n\nSometimes it makes sense to have one test be carried out for a large amount\nof different inputs. This module aims to provide an efficient way to deal with\nsuch situations.\n\nIt does so by allowing you to write fixtures (inputs) as plain members of a\nclass, and bind a test function to them. This test function is called for each\nfixture as you will see below. The produced class is a |tc|_ subclass, so it is\ncompatible with |ut|_ and other |ut|-compatible test runners.\n\n\n.. _testcase:\n\nBuilding a test case\n--------------------\n\nIn order to produce a |tc|_, ``repeated_test`` requires you to:\n\n* Subclass ``repeated_test.Fixtures``\n* Write a ``_test`` method that takes a few parameters, making use of any\n |tc|_ method it needs\n* Assign fixtures directly in the class body, which are then unpacked as\n arguments to the ``_test`` method\n\nYou can use any |tc|_ methods in your test function, such as ``assertEqual()``\nand so forth.\n\n.. code-block:: python\n\n from repeated_test import Fixtures\n\n class my_fixtures(Fixtures):\n def _test(self, arg1, arg2, arg3):\n self.assertEqual(..., ...)\n\n Ps = 'p1', 'p2', 'p3'\n # _test(*Ps) will be called, ie. _test('p1', p2', 'p3')\n\n Qs = 'q1', 'q2', 'q3'\n # _test(*Qs) will be called, ie. _test('q1', q2', 'q3')\n\nMake sure that your fixture tuples provide the correct amount of arguments\nfor your ``_test`` method, unless it has an ``*args`` parameter.\n\n\n.. _naming:\n.. _escaping:\n\nNaming and escaping\n-------------------\n\nYou may name your test tuples however you like, though they may not start with\n``test_`` or ``_``. They are copied to the resulting |tc|_ class, and test\nmethods are created for them. Their name is that of the tuple, prefixed with\n``test_``.\n\n.. _regular test methods:\n.. _regular:\n\nMembers starting with ``test_`` or ``_`` are directly copied over to the\nresulting |tc|_ class, without being treated as fixtures. You can use this to\ninsert regular tests amongst your fixtures, or constants that you do not wish\nto be treated as tests:\n\n.. code-block:: python\n\n from repeated_test import Fixtures\n\n class my_fixtures(Fixtures):\n def _test(self, arg1, arg2, arg3):\n self.assertEqual(..., ...)\n\n def test_other(self):\n self.assertEqual(3, 1+2)\n\n _spam = 'spam, bacon and eggs'\n # _spam won't be treated as a fixture, so _test(*_spam) won't be called\n\n ham = _spam, _spam, _spam\n\nYou may even call the test function using ``self._test(...)`` if necessary.\n\n\n.. _separate:\n\nSeparating tests and fixtures\n-----------------------------\n\nYou can apply a fixtures class to a different test function using its\n``with_test`` method:\n\n.. code-block:: python\n\n class my_fixtures(Fixtures):\n _test = None\n ...\n\n @my_fixtures.with_test\n def other_test(self, arg1, arg2, arg3):\n self.assertEqual(..., ...)\n\nWhile the function appears out of any class, it will be used as a method of\nthe resulting |tc|_ class, so keep in mind that it takes a ``self`` parameter.\n\nYou can reuse a fixture class however many times you like.\n\nIf you specify a test function this way, you can set ``_test = None``\nin your fixtures definition. However, it will not be discovered by |ut|_,\nso `regular test methods`_ won't be run.\nOmitting ``_test`` completely raises an error in order to prevent accidentally\ndisabling your tests.\n\n\n.. _decorator:\n\nWorking with functions as fixtures\n----------------------------------\n\nIt can be fairly impractical to use functions in your fixture tuples in this\nscheme. If your fixture tuple is meant to have one function in it, you can\nuse the ``tup`` decorator:\n\n.. code-block:: python\n\n from repeated_test import Fixtures, tup\n\n class my_tests(Fixtures):\n def _test(self, func, arg1, arg2):\n self.assertEqual(..., ...)\n\n @tup('arg1', 'arg2')\n def ham():\n pass\n # equivalent to\n def _ham():\n pass\n ham = _ham, 'arg1', 'arg2'\n\n\n.. _non-unittest:\n\nReplacing |tc| with another class\n---------------------------------\n\nYou can replace |tc| with another class using ``WithTestClass(cls)``.\n\nFor instance, if you wish to use ``unittest2``:\n\n.. code-block:: python\n\n import unittest2\n from repeated_test import WithTestClass\n\n class my_tests(WithTestClass(unittest2.TestCase)):\n ...\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/epsy/repeated_test", "keywords": "test,testing,unittest,fixtures", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "repeated-test", "package_url": "https://pypi.org/project/repeated-test/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/repeated-test/", "project_urls": { "Homepage": "https://github.com/epsy/repeated_test" }, "release_url": "https://pypi.org/project/repeated-test/1.0.1/", "requires_dist": [ "six (>=1.7)" ], "requires_python": "", "summary": "A quick unittest-compatible framework for repeating a test function over many fixtures", "version": "1.0.1" }, "last_serial": 2354954, "releases": { "0.1a1": [ { "comment_text": "", "digests": { "md5": "4c0c00e0bb3c4163af8ed8b5bc6309c5", "sha256": "a574ea4753a70c554da2ad1ca74a87a9f5dfb10b06947b3ad80b61f1442d60f6" }, "downloads": -1, "filename": "repeated_test-0.1a1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "4c0c00e0bb3c4163af8ed8b5bc6309c5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5892, "upload_time": "2016-01-26T11:52:59", "url": "https://files.pythonhosted.org/packages/49/43/9c4c9c7b13856cab71830b031e32aca4ef44f4d0cc9768181e100e1ffb65/repeated_test-0.1a1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b66c7d88bc51b91898cf7cd838c3a32c", "sha256": "7938ea2073d495e86c91a93281462f1d29ba37244620221e601dbb227cb8d484" }, "downloads": -1, "filename": "repeated_test-0.1a1.tar.gz", "has_sig": true, "md5_digest": "b66c7d88bc51b91898cf7cd838c3a32c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6683, "upload_time": "2016-01-26T11:53:25", "url": "https://files.pythonhosted.org/packages/34/59/bd8945a2c77f1961e7b61e3a74fbfb2797ef6660fe3a84c53f0840d7e9f5/repeated_test-0.1a1.tar.gz" } ], "0.1a2": [ { "comment_text": "", "digests": { "md5": "fcc9880017b5b83cc6381e06da1315b8", "sha256": "3df6809fe96d8c7758f5442545c8856530ca36971a838f132b1120eb401c3c6e" }, "downloads": -1, "filename": "repeated_test-0.1a2-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "fcc9880017b5b83cc6381e06da1315b8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6017, "upload_time": "2016-01-29T22:49:00", "url": "https://files.pythonhosted.org/packages/11/90/53a5b24c431773dbfb5f07c862cca207d819f1f077b45be0f7f29cc7f8c9/repeated_test-0.1a2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9f4e7a680a9a101083423aa4181d5dfd", "sha256": "47c36060a7645d7c2dea9af28cb3e6c05155145eeba96a44ed2373eb14b88cfe" }, "downloads": -1, "filename": "repeated_test-0.1a2.tar.gz", "has_sig": true, "md5_digest": "9f4e7a680a9a101083423aa4181d5dfd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6851, "upload_time": "2016-01-29T22:49:08", "url": "https://files.pythonhosted.org/packages/12/ee/2e3229b9a38c4ad7f9306a30cbddeb54fa215f9c302339c490a7ce8fa85d/repeated_test-0.1a2.tar.gz" } ], "0.1a3": [ { "comment_text": "", "digests": { "md5": "052c8f9687077589754f3742ba6e1d55", "sha256": "559e6483018c28bb969adac6bb2d29f15be53e09860acc72b087ef710f9fe5f1" }, "downloads": -1, "filename": "repeated_test-0.1a3-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "052c8f9687077589754f3742ba6e1d55", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6145, "upload_time": "2016-02-09T15:20:02", "url": "https://files.pythonhosted.org/packages/f1/19/a1f0e26cd05474973ea9606393c37fc65a88399dc3483995293a4750e0bf/repeated_test-0.1a3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e628979674be66a1adfa85d741de2a0e", "sha256": "efae24a3c51f37b405ad31dd7e193ef132df74591ffdd1b1e9e0093acff55a18" }, "downloads": -1, "filename": "repeated_test-0.1a3.tar.gz", "has_sig": true, "md5_digest": "e628979674be66a1adfa85d741de2a0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7002, "upload_time": "2016-02-09T15:20:49", "url": "https://files.pythonhosted.org/packages/82/58/2e7783f040fa3061e255dd6fbf49d935ea61dfb34466ef987271be83e67a/repeated_test-0.1a3.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "b0ead178a8bc565a770df2bc13a835b6", "sha256": "b8897dfcf7fde9e0b9e189cdd92020dad8275f0e871ad710e478e26041937f84" }, "downloads": -1, "filename": "repeated_test-1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "b0ead178a8bc565a770df2bc13a835b6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6514, "upload_time": "2016-09-07T15:13:06", "url": "https://files.pythonhosted.org/packages/da/c3/182c569d6e42fbbaae76ca72253b2450cec2d6bf6befadf59d318f349ebe/repeated_test-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7abd838092a9b3f23dce576c441fd932", "sha256": "73193f2bb360051ec78faeadc72b8b70240852e3f2746ff1da1526f4c03be33a" }, "downloads": -1, "filename": "repeated_test-1.0.tar.gz", "has_sig": true, "md5_digest": "7abd838092a9b3f23dce576c441fd932", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7310, "upload_time": "2016-09-07T15:13:09", "url": "https://files.pythonhosted.org/packages/77/05/b494d8f678b50f51e02d269e025e13673d067bc2242e763ff3ada5e46f54/repeated_test-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "bd144f093635e62f87db2f2cf7d2e0f6", "sha256": "3d558995949c54e9c1b1f0be31ba41a945859e252d318b35364fafd84a6bf4db" }, "downloads": -1, "filename": "repeated_test-1.0.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "bd144f093635e62f87db2f2cf7d2e0f6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6544, "upload_time": "2016-09-21T13:31:42", "url": "https://files.pythonhosted.org/packages/7a/d4/7165b8b3fd5854238659715a6507122f2c86716867fef37249e957f94e0b/repeated_test-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d9a8ab7777fe034a218743963da364f6", "sha256": "65107444a4945668ab7be6d1a3e1814cee9b2cfc577e7c70381700b11b809d27" }, "downloads": -1, "filename": "repeated_test-1.0.1.tar.gz", "has_sig": true, "md5_digest": "d9a8ab7777fe034a218743963da364f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7994, "upload_time": "2016-09-21T13:31:45", "url": "https://files.pythonhosted.org/packages/3b/22/dff6de1a68fcb9e426cb79e6d513595ab7206b2ca7d9a95df3a8264269c6/repeated_test-1.0.1.tar.gz" } ], "1.0b1": [ { "comment_text": "", "digests": { "md5": "650a67c90ce97afd128dda988f7035e9", "sha256": "3d393ee5e16ea2fbb933af89abbdea4de8067f692552202ca66059d7b026363f" }, "downloads": -1, "filename": "repeated_test-1.0b1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "650a67c90ce97afd128dda988f7035e9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6546, "upload_time": "2016-05-27T21:10:49", "url": "https://files.pythonhosted.org/packages/4a/4e/156fef1dd1fe8c3df75f9761e6a05231b7c009297758ba3ca57e7bd97db3/repeated_test-1.0b1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "28983884321bfd75f57ede3fa1903c37", "sha256": "89d64d42b7717601dfe17553b235d27420c9d0756437819f764ed45874b50bea" }, "downloads": -1, "filename": "repeated_test-1.0b1.tar.gz", "has_sig": true, "md5_digest": "28983884321bfd75f57ede3fa1903c37", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7304, "upload_time": "2016-05-27T21:10:54", "url": "https://files.pythonhosted.org/packages/11/c5/6f28b37d99de6c62243e8f6c901b99395e77ee1fe15b7036cf3deff43b52/repeated_test-1.0b1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bd144f093635e62f87db2f2cf7d2e0f6", "sha256": "3d558995949c54e9c1b1f0be31ba41a945859e252d318b35364fafd84a6bf4db" }, "downloads": -1, "filename": "repeated_test-1.0.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "bd144f093635e62f87db2f2cf7d2e0f6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6544, "upload_time": "2016-09-21T13:31:42", "url": "https://files.pythonhosted.org/packages/7a/d4/7165b8b3fd5854238659715a6507122f2c86716867fef37249e957f94e0b/repeated_test-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d9a8ab7777fe034a218743963da364f6", "sha256": "65107444a4945668ab7be6d1a3e1814cee9b2cfc577e7c70381700b11b809d27" }, "downloads": -1, "filename": "repeated_test-1.0.1.tar.gz", "has_sig": true, "md5_digest": "d9a8ab7777fe034a218743963da364f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7994, "upload_time": "2016-09-21T13:31:45", "url": "https://files.pythonhosted.org/packages/3b/22/dff6de1a68fcb9e426cb79e6d513595ab7206b2ca7d9a95df3a8264269c6/repeated_test-1.0.1.tar.gz" } ] }