{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Pytest", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# pytest-antilru\n\n[![Build Status](https://travis-ci.com/ipwnponies/pytest-antilru.svg?branch=master)](https://travis-ci.com/ipwnponies/pytest-antilru)\n[![Coverage Status](https://img.shields.io/coveralls/github/ipwnponies/pytest-antilru.svg)](https://coveralls.io/github/ipwnponies/pytest-antilru?branch=master)\n![license](https://img.shields.io/github/license/ipwnponies/pytest-antilru.svg)\n![supported python versions](https://img.shields.io/pypi/pyversions/pytest-antilru.svg)\n![pypi wheels](https://img.shields.io/pypi/wheel/pytest-antilru.svg)\n![pypi development status](https://img.shields.io/pypi/status/pytest-antilru.svg)\n\nCaching expensive function calls with `functools.lru_cache` is simple and great performance optimization.\nIt works so well that it'll even speed up your unit test runs!\nToo bad it violated test isolation and caches the wrong values under test conditions, introducing test pollution\n(persisted state between test runs).\nThis package will bust the `lru_cache` between test runs, avoiding test pollution and helping you keep your sanity.\n\nImagine you mock a network call out and your application ends up caching these mocked results:\n\n```python\ndef expensive_network_call() -> int:\n # Pretend this is an expensive network call.\n # You want to cache this for performance but you want to run tests with different responses as well.\n return 1\n\n\n@lru_cache()\ndef cache_me() -> int:\n return expensive_network_call()\n```\n\nNow you have test pollution:\n\n```python\ndef test_a_run_first() -> None:\n assert cache_me() == 1\n\n\ndef test_b_run_second() -> None:\n # We want to mock the network call for this test case\n with mock.patch.object(sys.modules[__name__], 'expensive_network_call', return_value=2) as mock_network_call:\n assert cache_me() == 2\n assert mock_network_call.called\n```\n\nOn your next test run, it doesn't matter what you\nmock, the results are already cached. Now trying running those two test out-of-order sequence and tell me how it goes.\n\n## Dependencies\n\nSince this is a `pytest` plugin, you need to be using `pytest` to run your tests.\n\nThis project is python 2.7 and python 3.5, 3.6, 3.7 compatible.\n\n## Installation\n\nSimply install this in the same python environment that `pytest` uses and the rest is magic.\n\n```sh\npip install pytest-antilru\n```\n\n## How to test the software\n\n```sh\nmake test\n```\n\n----\n\n## Credits and references\n\nThis project was a re-engineering of a similar project a colleague of mine wrote.\nThat project was not intended to be open-source and rather than go though all the hoops and hurdles to sanitize it,\nI've written it from the ground up such that it's kosher to open-source (given that it's such as small project).\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/ipwnponies/pytest-antilru", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pytest-antilru", "package_url": "https://pypi.org/project/pytest-antilru/", "platform": "", "project_url": "https://pypi.org/project/pytest-antilru/", "project_urls": { "Homepage": "https://github.com/ipwnponies/pytest-antilru" }, "release_url": "https://pypi.org/project/pytest-antilru/1.0.5/", "requires_dist": [ "pytest" ], "requires_python": "", "summary": "Bust functools.lru_cache when running pytest to avoid test pollution", "version": "1.0.5" }, "last_serial": 5127395, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "94d75d2e31071c849f6d36561309e3ee", "sha256": "bdc52f93d7dbc28167824b25bb4a043b366f4ef16d08ae47736e8b6e49563cb0" }, "downloads": -1, "filename": "pytest-antilru-0.2.0.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "94d75d2e31071c849f6d36561309e3ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2986, "upload_time": "2019-03-12T08:37:03", "url": "https://files.pythonhosted.org/packages/35/d2/5b8fdd3a95dd668a3a511e61ffb8dfeb63a0bb2861fcb476ad5f7796190c/pytest-antilru-0.2.0.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "adcff8caf02116d9da0b3a03fd5fa4bb", "sha256": "044f5f68f2100c40ec0cf961e2888fc1d78e52eb7f3dd2b0c8b7a79920679d2e" }, "downloads": -1, "filename": "pytest_antilru-0.2.0-py2-none-any.whl", "has_sig": false, "md5_digest": "adcff8caf02116d9da0b3a03fd5fa4bb", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3994, "upload_time": "2019-03-12T08:40:46", "url": "https://files.pythonhosted.org/packages/fd/f0/e4c5b57017890272d7ff0afbffe8686e82214b1bd54b3cde71cc1e06a934/pytest_antilru-0.2.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b64898b24b8db172cf6b87afd2278645", "sha256": "b111c91c29400fc6f4910c9775d1c549e8a48d644e4006182ae09b51d70c3ddd" }, "downloads": -1, "filename": "pytest_antilru-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b64898b24b8db172cf6b87afd2278645", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3748, "upload_time": "2019-03-12T08:38:38", "url": "https://files.pythonhosted.org/packages/62/12/a0faeca7202f968851d16005a9eb56ee9a083947c3d6b6cae2ddcbc20250/pytest_antilru-0.2.0-py3-none-any.whl" } ], "0.2.1.post1": [ { "comment_text": "", "digests": { "md5": "e11c32ca0fcf7ae5f93dd3b8c39948c6", "sha256": "b156e7488dd9a66234e13ce5e1006945e8f6cc4968d418a38b2d4696c321d490" }, "downloads": -1, "filename": "pytest_antilru-0.2.1.post1-py2-none-any.whl", "has_sig": false, "md5_digest": "e11c32ca0fcf7ae5f93dd3b8c39948c6", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 4670, "upload_time": "2019-03-14T08:23:00", "url": "https://files.pythonhosted.org/packages/df/e8/6c8dc7b87f114eff0213cd47f378ae3278f30b3004ac74c1e71385255285/pytest_antilru-0.2.1.post1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1e3166241055746d8879e97eb8834503", "sha256": "e123e2dd24d87e50bc1a3dabaddbff16a87e19cb17adc9b1994ff6821e8ce129" }, "downloads": -1, "filename": "pytest_antilru-0.2.1.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "1e3166241055746d8879e97eb8834503", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4670, "upload_time": "2019-03-14T08:23:02", "url": "https://files.pythonhosted.org/packages/2f/88/66157f3f2f16dd1c640ea8abf843e00fa98dda61c95804a076bb816d3258/pytest_antilru-0.2.1.post1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b155a94df7a85c0539abaa1a0aa9e471", "sha256": "0ca18e91be882895a8ec065be76d1c990e23d04375b9e8dba727d36b4e21415b" }, "downloads": -1, "filename": "pytest-antilru-0.2.1.post1.tar.gz", "has_sig": false, "md5_digest": "b155a94df7a85c0539abaa1a0aa9e471", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3409, "upload_time": "2019-03-14T08:23:03", "url": "https://files.pythonhosted.org/packages/71/c8/c4caec901d27876386922ae1ef8f3f714259ab4b057c21ff4df4d2de131e/pytest-antilru-0.2.1.post1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "3300761f48eb63128305256827eb488a", "sha256": "264f8a56c528c7224be378bfc28de7e68f82a2b3e582b3cf4ce988c72cc80e61" }, "downloads": -1, "filename": "pytest_antilru-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3300761f48eb63128305256827eb488a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4710, "upload_time": "2019-04-11T06:48:10", "url": "https://files.pythonhosted.org/packages/7e/1d/ee9b4ebf085f96c4850212425d310e24d31753d9b094430c3f146df78ac7/pytest_antilru-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "35143ac87d8acc3c7f8349f2e749fbca", "sha256": "4727560eeb2b0002785b0b2bc9cc040c199671c74e8301368ea97bbeb1f2b6d2" }, "downloads": -1, "filename": "pytest-antilru-1.0.0.tar.gz", "has_sig": false, "md5_digest": "35143ac87d8acc3c7f8349f2e749fbca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3548, "upload_time": "2019-04-11T06:48:11", "url": "https://files.pythonhosted.org/packages/18/de/36c5e0c10791fb57c94edd29b63bd22368662b0e03f15e9f2b802c2a9d84/pytest-antilru-1.0.0.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "ecc62c9682bbce700dcf0640ad2acc92", "sha256": "bfd61ea3bf7faf2158673bd9b50dbf2a22efaa7ff6eb9f301703f749adcf0e9e" }, "downloads": -1, "filename": "pytest_antilru-1.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ecc62c9682bbce700dcf0640ad2acc92", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4708, "upload_time": "2019-04-11T06:45:36", "url": "https://files.pythonhosted.org/packages/bc/25/cdcdf3de3a20b45c937e5c17dacda80bc1382b016046db36a66df50859bc/pytest_antilru-1.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3079e1bc17c84e1239c1633ffc5f125a", "sha256": "ec999a7c3428d6ddafe86d4cd800008dcc0fcc61066312afdc90eee81dd4fdcc" }, "downloads": -1, "filename": "pytest-antilru-1.0.5.tar.gz", "has_sig": false, "md5_digest": "3079e1bc17c84e1239c1633ffc5f125a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3553, "upload_time": "2019-04-11T06:45:37", "url": "https://files.pythonhosted.org/packages/d5/03/d6404d7b415b59bb0f50b02d86663cf3f3f46577857470169fe537512d91/pytest-antilru-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ecc62c9682bbce700dcf0640ad2acc92", "sha256": "bfd61ea3bf7faf2158673bd9b50dbf2a22efaa7ff6eb9f301703f749adcf0e9e" }, "downloads": -1, "filename": "pytest_antilru-1.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ecc62c9682bbce700dcf0640ad2acc92", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4708, "upload_time": "2019-04-11T06:45:36", "url": "https://files.pythonhosted.org/packages/bc/25/cdcdf3de3a20b45c937e5c17dacda80bc1382b016046db36a66df50859bc/pytest_antilru-1.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3079e1bc17c84e1239c1633ffc5f125a", "sha256": "ec999a7c3428d6ddafe86d4cd800008dcc0fcc61066312afdc90eee81dd4fdcc" }, "downloads": -1, "filename": "pytest-antilru-1.0.5.tar.gz", "has_sig": false, "md5_digest": "3079e1bc17c84e1239c1633ffc5f125a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3553, "upload_time": "2019-04-11T06:45:37", "url": "https://files.pythonhosted.org/packages/d5/03/d6404d7b415b59bb0f50b02d86663cf3f3f46577857470169fe537512d91/pytest-antilru-1.0.5.tar.gz" } ] }