From fcfcd53076e1ec9204deb82be00c98418c583d12 Mon Sep 17 00:00:00 2001 From: Ken Cochrane Date: Tue, 20 Feb 2018 09:34:14 -0500 Subject: [PATCH] Move mockredis to test requirements. replaces #115 (#119) Signed-off-by: Ken Cochrane --- CHANGES | 4 ++++ README.md | 3 +++ defender/connection.py | 7 +++---- setup.py | 8 ++++---- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index f5a2259..e9c1e44 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +0.5.3 +===== +- Remove mockredis as install requirement, make only test requirement [@blueyed] + 0.5.2 ===== - Fix regex in 'unblock_username_view' to handle special symbols [@ruthus18] diff --git a/README.md b/README.md index 4e0a694..81124fd 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,9 @@ If you are using defender on your site, submit a PR to add to the list. Versions ======== +- 0.5.3 [in progress] + - Remove mockredis as install requirement, make only test requirement [@blueyed] + - 0.5.2 - Fix regex in 'unblock_username_view' to handle special symbols [@ruthus18] - Fix django requires version for 1.11.x [@kencochrane] diff --git a/defender/connection.py b/defender/connection.py index a4db7b4..340f015 100644 --- a/defender/connection.py +++ b/defender/connection.py @@ -1,6 +1,6 @@ from django.core.cache import caches from django.core.cache.backends.base import InvalidCacheBackendError -import mockredis + import redis try: import urlparse @@ -12,8 +12,6 @@ # Register database schemes in URLs. urlparse.uses_netloc.append("redis") - -MOCKED_REDIS = mockredis.mock_strict_redis_client() INVALID_CACHE_ERROR_MSG = 'The cache {} was not found on the django cache' \ ' settings.' @@ -21,7 +19,8 @@ def get_redis_connection(): """ Get the redis connection if not using mock """ if config.MOCK_REDIS: # pragma: no cover - return MOCKED_REDIS # pragma: no cover + import mockredis + return mockredis.mock_strict_redis_client() # pragma: no cover elif config.DEFENDER_REDIS_NAME: # pragma: no cover try: cache = caches[config.DEFENDER_REDIS_NAME] diff --git a/setup.py b/setup.py index bfb5652..90c38a0 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from distutils.core import setup -version = '0.5.2' +version = '0.5.3' def get_packages(package): @@ -68,7 +68,7 @@ def get_package_data(package): include_package_data=True, packages=get_packages('defender'), package_data=get_package_data('defender'), - install_requires=['Django>=1.8,<2.1', 'redis>=2.10.3,<3.0', - 'mockredispy>=2.9.0.11,<3.0'], - tests_require=['mock', 'mockredispy', 'coverage', 'celery', 'django-redis-cache'], + install_requires=['Django>=1.8,<2.1', 'redis>=2.10.3,<3.0'], + tests_require=['mock', 'mockredispy>=2.9.0.11,<3.0', 'coverage', + 'celery', 'django-redis-cache'], )