Move mockredis to test requirements. replaces #115 (#119)

Signed-off-by: Ken Cochrane <KenCochrane@gmail.com>
This commit is contained in:
Ken Cochrane 2018-02-20 09:34:14 -05:00 committed by GitHub
parent 104eda3d03
commit fcfcd53076
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 8 deletions

View file

@ -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]

View file

@ -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]

View file

@ -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 @@ from . import config
# 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 @@ INVALID_CACHE_ERROR_MSG = 'The cache {} was not found on the django cache' \
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]

View file

@ -9,7 +9,7 @@ except ImportError:
from distutils.core import setup
version = '0.5.2'
version = '0.5.3'
def get_packages(package):
@ -68,7 +68,7 @@ setup(name='django-defender',
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'],
)