Skip to content

Commit

Permalink
Confirm support for Django 1.9/1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Aug 26, 2016
1 parent 1b2be04 commit 6e413f9
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 15 deletions.
18 changes: 13 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
language: python
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- 2.7
- 3.3
- 3.4
- 3.5
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
install: ./install_redis.sh
script: make test DJANGO_VERSION=$DJANGO_VERSION
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
SHELL := /bin/bash

PACKAGE_NAME=redis_cache
DJANGO_VERSION?=1.7
DJANGO_VERSION?=>=1.10a1,<1.11

.PHONY: install_requirements
install_requirements: requirements*.txt
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install Django==$(DJANGO_VERSION)
pip install 'Django$(DJANGO_VERSION)'

.PHONY: clean
clean:
Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Changelog
-----

* Drops support for Django < 1.8 and Python 3.2.
* Confirms support for Django 1.9 and 1.10.

1.5.0
-----
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
hiredis==0.2.0
django-nose==1.4
django-nose==1.4.4
nose==1.3.6
msgpack-python==0.4.6
pyyaml==3.11
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 1.8",
"Framework :: Django :: 1.9",
"Framework :: Django :: 1.10",
],
)
10 changes: 6 additions & 4 deletions tests/testapp/tests/base_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
except ImportError:
import pickle

from django.core.cache import get_cache
from django.core.cache import caches
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, override_settings
from django.utils.encoding import force_bytes
Expand Down Expand Up @@ -122,6 +122,8 @@ def setUp(self):
self.cache = self.get_cache()

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
# test default initialization and that may be using a different port
# than the test redis server.
Expand All @@ -134,7 +136,7 @@ def reset_pool(self):
pool.reset()

def get_cache(self, backend=None):
return get_cache(backend or 'default')
return caches[backend or 'default']


class BaseRedisTestCase(SetupMixin):
Expand Down Expand Up @@ -514,7 +516,7 @@ def assertMaxConnection(self, cache, max_num):

def test_max_connections(self):
pool._connection_pools = {}
cache = get_cache('default')
cache = caches['default']

def noop(*args, **kwargs):
pass
Expand Down Expand Up @@ -620,7 +622,7 @@ class ConfigurationTestCase(SetupMixin, TestCase):
)
def test_bad_parser_import(self):
with self.assertRaises(ImproperlyConfigured):
get_cache('default')
caches['default']


@override_settings(CACHES={
Expand Down
6 changes: 3 additions & 3 deletions tests/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.core.cache import get_cache
from django.core.cache import caches
from django.http import HttpResponse


def someview(request):
cache = get_cache('redis_cache.cache://127.0.0.1')
cache = caches['default']
cache.set("foo", "bar")
return HttpResponse("Pants")
return HttpResponse("Pants")

0 comments on commit 6e413f9

Please sign in to comment.