Commit 6e413f92 authored by Tim Graham's avatar Tim Graham

Confirm support for Django 1.9/1.10

parent 1b2be04a
language: python language: python
python: python:
- "2.7" - 2.7
- "3.3" - 3.3
- "3.4" - 3.4
- "3.5" - 3.5
env: env:
- DJANGO_VERSION=1.8 - DJANGO_VERSION='>=1.8a1,<1.9'
- DJANGO_VERSION='>=1.9a1,<1.10'
- DJANGO_VERSION='>=1.10a1,<1.11'
matrix:
exclude:
- python: 3.3
env: DJANGO_VERSION='>=1.9a1,<1.10'
- python: 3.3
env: DJANGO_VERSION='>=1.10a1,<1.11'
# command to run tests # command to run tests
install: ./install_redis.sh install: ./install_redis.sh
script: make test DJANGO_VERSION=$DJANGO_VERSION script: make test DJANGO_VERSION=$DJANGO_VERSION
......
SHELL := /bin/bash SHELL := /bin/bash
PACKAGE_NAME=redis_cache PACKAGE_NAME=redis_cache
DJANGO_VERSION?=1.7 DJANGO_VERSION?=>=1.10a1,<1.11
.PHONY: install_requirements .PHONY: install_requirements
install_requirements: requirements*.txt install_requirements: requirements*.txt
pip install -r requirements.txt pip install -r requirements.txt
pip install -r requirements-dev.txt pip install -r requirements-dev.txt
pip install Django==$(DJANGO_VERSION) pip install 'Django$(DJANGO_VERSION)'
.PHONY: clean .PHONY: clean
clean: clean:
......
...@@ -25,6 +25,7 @@ Changelog ...@@ -25,6 +25,7 @@ Changelog
----- -----
* Drops support for Django < 1.8 and Python 3.2. * Drops support for Django < 1.8 and Python 3.2.
* Confirms support for Django 1.9 and 1.10.
1.5.0 1.5.0
----- -----
......
hiredis==0.2.0 hiredis==0.2.0
django-nose==1.4 django-nose==1.4.4
nose==1.3.6 nose==1.3.6
msgpack-python==0.4.6 msgpack-python==0.4.6
pyyaml==3.11 pyyaml==3.11
...@@ -21,5 +21,7 @@ setup( ...@@ -21,5 +21,7 @@ setup(
"Environment :: Web Environment", "Environment :: Web Environment",
"Framework :: Django", "Framework :: Django",
"Framework :: Django :: 1.8", "Framework :: Django :: 1.8",
"Framework :: Django :: 1.9",
"Framework :: Django :: 1.10",
], ],
) )
...@@ -12,7 +12,7 @@ try: ...@@ -12,7 +12,7 @@ try:
except ImportError: except ImportError:
import pickle import pickle
from django.core.cache import get_cache from django.core.cache import caches
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
...@@ -122,6 +122,8 @@ class SetupMixin(object): ...@@ -122,6 +122,8 @@ class SetupMixin(object):
self.cache = self.get_cache() self.cache = self.get_cache()
def tearDown(self): def tearDown(self):
# clear caches to allow @override_settings(CACHES=...) to work.
caches._caches.caches = {}
# Sometimes it will be necessary to skip this method because we need to # Sometimes it will be necessary to skip this method because we need to
# test default initialization and that may be using a different port # test default initialization and that may be using a different port
# than the test redis server. # than the test redis server.
...@@ -134,7 +136,7 @@ class SetupMixin(object): ...@@ -134,7 +136,7 @@ class SetupMixin(object):
pool.reset() pool.reset()
def get_cache(self, backend=None): def get_cache(self, backend=None):
return get_cache(backend or 'default') return caches[backend or 'default']
class BaseRedisTestCase(SetupMixin): class BaseRedisTestCase(SetupMixin):
...@@ -514,7 +516,7 @@ class BaseRedisTestCase(SetupMixin): ...@@ -514,7 +516,7 @@ class BaseRedisTestCase(SetupMixin):
def test_max_connections(self): def test_max_connections(self):
pool._connection_pools = {} pool._connection_pools = {}
cache = get_cache('default') cache = caches['default']
def noop(*args, **kwargs): def noop(*args, **kwargs):
pass pass
...@@ -620,7 +622,7 @@ class ConfigurationTestCase(SetupMixin, TestCase): ...@@ -620,7 +622,7 @@ class ConfigurationTestCase(SetupMixin, TestCase):
) )
def test_bad_parser_import(self): def test_bad_parser_import(self):
with self.assertRaises(ImproperlyConfigured): with self.assertRaises(ImproperlyConfigured):
get_cache('default') caches['default']
@override_settings(CACHES={ @override_settings(CACHES={
......
from django.core.cache import get_cache from django.core.cache import caches
from django.http import HttpResponse from django.http import HttpResponse
def someview(request): def someview(request):
cache = get_cache('redis_cache.cache://127.0.0.1') cache = caches['default']
cache.set("foo", "bar") cache.set("foo", "bar")
return HttpResponse("Pants") return HttpResponse("Pants")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment