{ "info": { "author": "Sebastian Rittau", "author_email": "srittau@rittau.biz", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing" ], "description": "# Improved TestCase Class\n\n\n[![License](https://img.shields.io/pypi/l/dectest.svg)](https://pypi.python.org/pypi/dectest/)\n[![Github](https://img.shields.io/github/release/srittau/python-dectest/all.svg)](https://github.com/srittau/python-dectest/releases/)\n[![pypi](https://img.shields.io/pypi/v/dectest.svg)](https://pypi.python.org/pypi/dectest/)\n[![Travis CI](https://travis-ci.org/srittau/python-dectest.svg?branch=master)](https://travis-ci.org/srittau/python-dectest)\n\n`dectest.TestCase` is a drop-in replacement for `unittest.TestCase` with\na few added features.\n\n## Tests, Setup, and Teardown with Decorators\n\nTests can optionally be marked using the `@test` decorator, instead of\nprefixing the method name with `test`. The following test case class\ncontains two tests:\n\n```python\nfrom dectest import TestCase, test\n\nclass MyTest(TestCase):\n def test_foo(self):\n pass\n\n @test\n def bar(self):\n pass\n```\n\nSetup and teardown methods can be marked using the `@before` and `@after`\ndecorators, respectively. A class can have multiple setup and teardown\nmethods:\n\n```python\nfrom dectest import TestCase, before, after\n\nclass MyTest(TestCase):\n @before\n def setup_stuff(self):\n pass\n\n @before\n def setup_more_stuff(self):\n pass\n\n @after\n def teardown_all_stuff(self):\n pass\n```\n\nWhile the order of execution inside a class is undefined and should not be\nrelied upon, it is guaranteed that setup methods in super-classes are\nexecuted before methods in sub-classes, and teardown methods in sub-classes\nare executed before teardown method in super-classes:\n\n```python\nfrom dectest import TestCase, before, after\n\nclass MySuperTest(TestCase):\n @before\n def super_setup(self):\n print(\"setup first\")\n\n @after\n def super_teardown(self):\n print(\"teardown second\")\n\nclass MySubTest(MySuperTest):\n @before\n def sub_setup(self):\n print(\"setup second\")\n\n @after\n def sub_teardown(self):\n print(\"teardown first\")\n```\n\n## Patch Support\n\n`dectest.TestCase` has a `patch()` method to install a mock using\n`unittest.mock.patch()`. This patch is removed during test\nteardown:\n\n```python\nfrom dectest import TestCase, test\n\nclass MyPatchTest(TestCase):\n @test\n def foo(self):\n exit = self.patch(\"sys.exit\") # will be stopped during teardown\n # call implementation\n exit.assert_called_with(1)\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/srittau/python-dectest", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "dectest", "package_url": "https://pypi.org/project/dectest/", "platform": "", "project_url": "https://pypi.org/project/dectest/", "project_urls": { "Homepage": "https://github.com/srittau/python-dectest" }, "release_url": "https://pypi.org/project/dectest/1.1.1/", "requires_dist": null, "requires_python": ">=3.5", "summary": "Improved TestCase class", "version": "1.1.1" }, "last_serial": 5566499, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e2d222ee59b9128e80e2495fab38c713", "sha256": "fab5c83d26e657e826b09420c0bd7ddd922218d35c6b689d598bbe4cef3c2538" }, "downloads": -1, "filename": "dectest-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e2d222ee59b9128e80e2495fab38c713", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 4173, "upload_time": "2018-06-01T17:25:12", "url": "https://files.pythonhosted.org/packages/c6/89/b2fb81403a04316d2a3035ce07d792a672a4d11648aa61c9d0ec75f2b3bd/dectest-0.1.0-py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "d883d2f388097f3ccb909d724c2b86f1", "sha256": "0693e6e6d0115fec724ae30e09bff9f8ce8521840f98e12b5c1df989fedeaf37" }, "downloads": -1, "filename": "dectest-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d883d2f388097f3ccb909d724c2b86f1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 4198, "upload_time": "2018-06-06T16:01:42", "url": "https://files.pythonhosted.org/packages/7e/bc/60cbfc7718cb44bc46ff466d0af8948d4c184506d72d78d7a9d368453a43/dectest-0.1.2-py3-none-any.whl" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "3e4855a62f8f01148c2a75e9190954e3", "sha256": "dfa48ae4c4455224d1ff96a5b29b1fb5463fdbdea8e043e88d515cdc4790f37f" }, "downloads": -1, "filename": "dectest-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3e4855a62f8f01148c2a75e9190954e3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 4205, "upload_time": "2018-08-16T12:43:53", "url": "https://files.pythonhosted.org/packages/93/69/cb0527ea34e73d802e1e1b0e0c2ac5e99c8b8f813cb217c3a2eb982d8d8d/dectest-1.0.0-py3-none-any.whl" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "a9d812cafb88bd1c6450fd8e596f4250", "sha256": "6701c356b6f81a27fea2c089d7b4c50a455f5b8f008b6e2751e7aef801c3d16d" }, "downloads": -1, "filename": "dectest-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a9d812cafb88bd1c6450fd8e596f4250", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 5309, "upload_time": "2019-05-16T11:44:44", "url": "https://files.pythonhosted.org/packages/96/c3/b09293faa384fc15d949f170f8271066d4c98f899682bd2551c8f2862bfd/dectest-1.1.0-py3-none-any.whl" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "dce70ac84178c5f61c581b6ea860b54d", "sha256": "699e3ade7853448306e1471ed2e4b9e2c229e381a17c05fb3c8f2363ec8f71d5" }, "downloads": -1, "filename": "dectest-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "dce70ac84178c5f61c581b6ea860b54d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 5341, "upload_time": "2019-07-22T09:39:05", "url": "https://files.pythonhosted.org/packages/ff/99/9605a8b6db98c44f338c7b4429cb87c8826d47c85ee2b42e96793fd224ef/dectest-1.1.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dce70ac84178c5f61c581b6ea860b54d", "sha256": "699e3ade7853448306e1471ed2e4b9e2c229e381a17c05fb3c8f2363ec8f71d5" }, "downloads": -1, "filename": "dectest-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "dce70ac84178c5f61c581b6ea860b54d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 5341, "upload_time": "2019-07-22T09:39:05", "url": "https://files.pythonhosted.org/packages/ff/99/9605a8b6db98c44f338c7b4429cb87c8826d47c85ee2b42e96793fd224ef/dectest-1.1.1-py3-none-any.whl" } ] }