{ "info": { "author": "o3o3o", "author_email": "o3o3o.me@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "[![CircleCI](https://circleci.com/gh/o3o3o/django-fakeredis.svg?style=svg)](https://circleci.com/gh/o3o3o/django-fakeredis)\n\nEasier use [fakeredis](https://pypi.org/project/fakeredis) in Django.\n\n\n### Install\n\n```\npip install django-fakeredis\n```\n\n## Why use it?\n\nI have experienced many times to find bugs which is caused by mutiple fakeredis instances in tests.\nWe just want to use fakerredis like redis with one redis-server and different connections and can debug with MONITOR command in redis\n\n### Features:\n\n* One fakeredis server with mutiple connections for tests like the way of using redis. \n* Combine override settings to Local-memory and fake [get_redis_connection](https://github.com/niwinz/django-redis), [django's cache](https://docs.djangoproject.com/en/2.2/topics/cache/)\n* To disable the fake action with passing env: \"NOFAKE_REDIS=1\"\n `NOFAKE_REDIS=1 python manage.py test`\n\nBefore you use `django_fakeredis`, your tests code maybe like that:\n\n```python\nserver = fakeredis.FakeServer()\n@override_settings(CACHES={\"default\": {\"BACKEND\": \"django.core.cache.backends.dummy.DummyCache\" }})\n@patch('foo.get_redis_connection', fakeredis.FakeRedis(server=server)\ndef test_sth():\n ....\n```\n\nNow your can just:\n```python\n@FakeRedis(\"yourpath.get_redis_connection\")\ndef test_sth():\n ...\n```\n\n\n\n### Usage\n```python\n\nfrom django_fakeredis import FakeRedis\n@FakeRedis(\"yourpath.get_redis_connection\")\ndef test_foo():\n ...\n```\n\n\n```python\nfrom django_fakeredis import FakeRedis\nwith FakeRedis(\"yourpath.get_redis_connection\"):\n foo()\n```\n\n```python\nfrom django_fakeredis import FakeRedis\nwith FakeRedis(\"yourpath.cache\"):\n foo()\n```\n\n#### NOTE\n\n1. If you want to mock `django.core.cache.cache` with fakeredis, django-fakeredis do nothing but just override CACHE settings into [Local-Memory](https://docs.djangoproject.com/en/2.2/topics/cache/#local-memory-caching) for using the internal cast. So there are two mocked redis instance for django.cache and get_redis_connection .\n\nIf you want to use more redis commands, such as: sets, list..., you may need use [django_redis]((https://github.com/niwinz/django-redis)), and cast the result by hand.\n\ndjango.cache:\n```\nfrom django.core.cache import cache\ncache.set(\"key\", 2)\nassert cache.get(\"key\") == 2\n```\n\nyou have to cast by hand, when using fakeredis or django_redis directly, you have to cast by hand:\n\n```\nimport fakeredis\ncon = fakeredis.FakeStrictRedis()\ncon.set(\"key\", 2)\nassert con.get(\"key\").decode('utf8') == \"2\"\n```\n\n2. if you have a problem that mock is not worked, you may should to see [where to patch](https://docs.python.org/3/library/unittest.mock.html#where-to-patch)\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/o3o3o/django-fakeredis", "keywords": "", "license": "Apache Software License", "maintainer": "", "maintainer_email": "", "name": "django-fakeredis", "package_url": "https://pypi.org/project/django-fakeredis/", "platform": "", "project_url": "https://pypi.org/project/django-fakeredis/", "project_urls": { "Homepage": "https://github.com/o3o3o/django-fakeredis" }, "release_url": "https://pypi.org/project/django-fakeredis/0.1.1/", "requires_dist": [ "fakeredis", "redis", "django-redis" ], "requires_python": "", "summary": "Easier to use fakeredis in Django.", "version": "0.1.1" }, "last_serial": 5676717, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "3174c502c0b2feec68591c14cb45f5a2", "sha256": "54235a18401f3844c78ccc819f49466c5cc7836c92b3a8d038cc092e40340baf" }, "downloads": -1, "filename": "django_fakeredis-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3174c502c0b2feec68591c14cb45f5a2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3671, "upload_time": "2019-07-28T03:51:57", "url": "https://files.pythonhosted.org/packages/fb/57/32c41374d05d21cc000c06bb524efafad89b2d8de24c1a5bb4c497144240/django_fakeredis-0.0.1-py3-none-any.whl" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "2fab24ccf593cadb524011a679212aa9", "sha256": "5d3de9ee3c05670d635690eeffcb5945a88a532d280a9ef5d1612d0916326455" }, "downloads": -1, "filename": "django_fakeredis-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "2fab24ccf593cadb524011a679212aa9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4170, "upload_time": "2019-07-28T13:49:49", "url": "https://files.pythonhosted.org/packages/09/5a/5722bea4f214300f27c6a152c3efd621c7408710931b4683b96fe93237c0/django_fakeredis-0.0.2-py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "c4fc87682a602159ba0100dda0c740d4", "sha256": "5daedded4e82a4ef6bbb04fb2f1dbde53995612aba53a52e8a87c03d6a732518" }, "downloads": -1, "filename": "django_fakeredis-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "c4fc87682a602159ba0100dda0c740d4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4239, "upload_time": "2019-07-31T12:49:56", "url": "https://files.pythonhosted.org/packages/37/0d/d8456aba336dba91f312add4372526f6e656b6e377bd5101074f0a9764e2/django_fakeredis-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "02e6a3c5959ce6cde596ddc261815660", "sha256": "16f0fa2975df907b95ad8a84097b01c62f7cd10af7a8f3870b0b7e81b6393e30" }, "downloads": -1, "filename": "django-fakeredis-0.0.4.tar.gz", "has_sig": false, "md5_digest": "02e6a3c5959ce6cde596ddc261815660", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3219, "upload_time": "2019-07-31T12:49:57", "url": "https://files.pythonhosted.org/packages/98/31/f1d775545ac38cd8434210e6c47772c6ff98f237a5d6288864db1df09c81/django-fakeredis-0.0.4.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "f9b7ae23ecdc517922048ee98b856b8a", "sha256": "5218286763ad8950ccf6a34119332cff024e64008d5a28546ad0e12be4fbf64b" }, "downloads": -1, "filename": "django_fakeredis-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f9b7ae23ecdc517922048ee98b856b8a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4579, "upload_time": "2019-08-09T10:27:07", "url": "https://files.pythonhosted.org/packages/0d/4c/58d7967ccd1298124087657a8c815db57efbc5af7df052d85b4549aee275/django_fakeredis-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "144c94abec8bba9ce6efe5982cf15911", "sha256": "7e8988e54962c1755b3267d8a6609f97369f2327f16e238d4fd51fd357092ceb" }, "downloads": -1, "filename": "django-fakeredis-0.1.0.tar.gz", "has_sig": false, "md5_digest": "144c94abec8bba9ce6efe5982cf15911", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3632, "upload_time": "2019-08-09T10:27:11", "url": "https://files.pythonhosted.org/packages/00/8c/a69f9d4633d43d721ddc26a13e2b9e02d4c0c2adbf1af751b12975b24691/django-fakeredis-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "856418eb5c24f5d64058428ac216466c", "sha256": "ac780412de28290f6490899b88c7aa1ba68b4575b99bdeb41f88f74f4cbfefa4" }, "downloads": -1, "filename": "django_fakeredis-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "856418eb5c24f5d64058428ac216466c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4591, "upload_time": "2019-08-14T12:19:49", "url": "https://files.pythonhosted.org/packages/92/03/2cf806faca9c12fea31687b99d2517518ad9b0c328d647cd97415ea59947/django_fakeredis-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4371eefa0803bc52f49160e875997b20", "sha256": "a872f0add6535e8bac2c8ea388c9318719c2e560e3227a5ec779b90eec031ba5" }, "downloads": -1, "filename": "django-fakeredis-0.1.1.tar.gz", "has_sig": false, "md5_digest": "4371eefa0803bc52f49160e875997b20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3648, "upload_time": "2019-08-14T12:19:51", "url": "https://files.pythonhosted.org/packages/f8/1e/3d289a3623ace902f0fcd2e7a52c2d4146a1c1c5dba5ca42390fc60b88cf/django-fakeredis-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "856418eb5c24f5d64058428ac216466c", "sha256": "ac780412de28290f6490899b88c7aa1ba68b4575b99bdeb41f88f74f4cbfefa4" }, "downloads": -1, "filename": "django_fakeredis-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "856418eb5c24f5d64058428ac216466c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4591, "upload_time": "2019-08-14T12:19:49", "url": "https://files.pythonhosted.org/packages/92/03/2cf806faca9c12fea31687b99d2517518ad9b0c328d647cd97415ea59947/django_fakeredis-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4371eefa0803bc52f49160e875997b20", "sha256": "a872f0add6535e8bac2c8ea388c9318719c2e560e3227a5ec779b90eec031ba5" }, "downloads": -1, "filename": "django-fakeredis-0.1.1.tar.gz", "has_sig": false, "md5_digest": "4371eefa0803bc52f49160e875997b20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3648, "upload_time": "2019-08-14T12:19:51", "url": "https://files.pythonhosted.org/packages/f8/1e/3d289a3623ace902f0fcd2e7a52c2d4146a1c1c5dba5ca42390fc60b88cf/django-fakeredis-0.1.1.tar.gz" } ] }