{ "info": { "author": "Ben Lopatin", "author_email": "ben@wellfire.co", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4" ], "description": "=================================\ngarland: Python decorator mocking\n=================================\n\n.. image:: https://secure.travis-ci.org/bennylope/garland.svg?branch=master\n :alt: Build Status\n :target: http://travis-ci.org/bennylope/garland\n\n.. image:: https://pypip.in/v/garland/badge.svg\n :alt: Current PyPI release\n :target: https://crate.io/packages/garland\n\n.. image:: https://pypip.in/d/garland/badge.svg\n :alt: Download count\n :target: https://crate.io/packages/garland\n\nGarland is simple, repeatable decorator mocking.\n\nWhy?\n====\n\nDecorators are applied at the time the decorated function is first imported, which\nmakes `mocking them a bit more challenging `_.\n\nI want to be able to be simply patch decorators - typically making them just pass-throughs to\nignore their functionality - without modifying the underlying codebase. And I don't want\nto worry about whether a module has already been loaded and is now unpatchable, or it needs\nto be patched for every test... and I don't want to write the patching/loading/reloading\ncode for every test.\n\nUsage\n=====\n\nProvided you have a function that you want to test, like so:\n\n.. code:: python\n\n @my_decorator\n def something_cool(*args, **kwargs):\n ...\n return some_var\n\nWith your `my_decoroator` decorator defined in another module, you can mock\n`my_decorator` so that you can test just the end decorated function.\n\nIn your test, apply the `tinsel` decorator function to the test method where\nyou want the decorator mocked.\n\n.. code:: python\n\n @garland.tinsel('utils.decorators.my_decorator', 'very_cool.module')\n def test_something_cool(self):\n self.assertEqual(very_cool.module.something_cool(), \"undecorated value\")\n\nNow `test_something` can test the return values from `something_cool` without\nthe decorator potentially returning a different value, or providing a different\nfunction interface.\n\nThe `tinsel` decorator takes two arguments:\n\n1. A dotted path to the decorator function you want to mock\n2. A dotted path to the module in which your function - the one you're testing -\n is declared. If you're not importing the module like this in your tests then\n this will do you little good (see limits, below).\n\nLimits\n======\n\n1. You need to import modules, not named functions, to work with garland.\n2. For now this is only tested with decorator functions and function decorators\n3. The mock turns your decorator into a pass-through, assuming that this is the\n way you want to mock it.\n4. Only Python 3.4 and Python 2.7 are supported at this time.\n\n\nLicense\n=======\n\nCopyright Ben Lopatin. BSD licensed (see `LICENSE`).\n\n\n\n\nHistory\n-------\n\n0.1.0 (2015-01-15)\n---------------------\n\n* First release on PyPI.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bennylope/garland", "keywords": "garland", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "garland", "package_url": "https://pypi.org/project/garland/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/garland/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/bennylope/garland" }, "release_url": "https://pypi.org/project/garland/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Python decorator mocking.", "version": "0.2.0" }, "last_serial": 1383798, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3b4f553b914915a1e460d780426b1a09", "sha256": "9c119227b7ffdaf3cbb6bd9c22ca8b2e7fafcd4f0b8a16738037c1dbf07a8f78" }, "downloads": -1, "filename": "garland-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3b4f553b914915a1e460d780426b1a09", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 4149, "upload_time": "2015-01-15T16:00:54", "url": "https://files.pythonhosted.org/packages/6a/b8/a6f6d21fe62b9e0086bddbc6eea44443890fc10831531d3284d8bbc123a2/garland-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d403806fb2c4518773d65f4ae811e57c", "sha256": "1094dd5f83fab2b60296bd48819e3b67370db8bd6691d86c0a1aa428afcff590" }, "downloads": -1, "filename": "garland-0.1.0.tar.gz", "has_sig": false, "md5_digest": "d403806fb2c4518773d65f4ae811e57c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12060, "upload_time": "2015-01-15T16:00:30", "url": "https://files.pythonhosted.org/packages/6a/fd/0b65e3d1bb7ac9ac2cccc48aa6ad1be639a396392382f97e1d24f248ebde/garland-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "9ad1582153ae7e129697f8eaf4a73f93", "sha256": "569f116e89814cc38bdeec9172d1954844deee97020859e5a3b6b6c81178771b" }, "downloads": -1, "filename": "garland-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9ad1582153ae7e129697f8eaf4a73f93", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 5132, "upload_time": "2015-01-15T16:52:04", "url": "https://files.pythonhosted.org/packages/19/03/ec0951901babd2b3d4d07661de295c0b76f0e6896643ef0017282c2c2fbc/garland-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f20173ebc71b1affe11115f6ca3a0022", "sha256": "48353de4245c6da526f968314be7d0ecfcec79e6a6813ef9426843d9dc2c12a7" }, "downloads": -1, "filename": "garland-0.2.0.tar.gz", "has_sig": false, "md5_digest": "f20173ebc71b1affe11115f6ca3a0022", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12809, "upload_time": "2015-01-15T16:52:02", "url": "https://files.pythonhosted.org/packages/44/8c/b5e81a0544c1e8c17322615e8b477d486cfdda1b3932e5191bd745047fff/garland-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9ad1582153ae7e129697f8eaf4a73f93", "sha256": "569f116e89814cc38bdeec9172d1954844deee97020859e5a3b6b6c81178771b" }, "downloads": -1, "filename": "garland-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9ad1582153ae7e129697f8eaf4a73f93", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 5132, "upload_time": "2015-01-15T16:52:04", "url": "https://files.pythonhosted.org/packages/19/03/ec0951901babd2b3d4d07661de295c0b76f0e6896643ef0017282c2c2fbc/garland-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f20173ebc71b1affe11115f6ca3a0022", "sha256": "48353de4245c6da526f968314be7d0ecfcec79e6a6813ef9426843d9dc2c12a7" }, "downloads": -1, "filename": "garland-0.2.0.tar.gz", "has_sig": false, "md5_digest": "f20173ebc71b1affe11115f6ca3a0022", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12809, "upload_time": "2015-01-15T16:52:02", "url": "https://files.pythonhosted.org/packages/44/8c/b5e81a0544c1e8c17322615e8b477d486cfdda1b3932e5191bd745047fff/garland-0.2.0.tar.gz" } ] }