Skip to content

Commit

Permalink
Move mockredis to test requirements. replaces jazzband#115 (jazzband#119
Browse files Browse the repository at this point in the history
)

Signed-off-by: Ken Cochrane <KenCochrane@gmail.com>
  • Loading branch information
kencochrane authored Feb 20, 2018
1 parent 104eda3 commit fcfcd53
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 3 additions & 4 deletions defender/connection.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,16 +12,15 @@
# 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.'


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]
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from distutils.core import setup


version = '0.5.2'
version = '0.5.3'


def get_packages(package):
Expand Down Expand Up @@ -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'],
)

0 comments on commit fcfcd53

Please sign in to comment.