Skip to content

Commit 0ddb133

Browse files
authored
Merge pull request sebleier#204 from felixxm/django32
Confirm support for Django 3.2.
2 parents 86e5434 + 01260d5 commit 0ddb133

File tree

6 files changed

+22
-7
lines changed

6 files changed

+22
-7
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ python:
77
env:
88
- DJANGO_VERSION='>=3.0,<3.1'
99
- DJANGO_VERSION='>=3.1,<3.2'
10+
- DJANGO_VERSION='>=3.2,<4.0'
1011
# command to run tests
1112
install: ./install_redis.sh
1213
script: make test DJANGO_VERSION=$DJANGO_VERSION

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SHELL := /bin/bash
22

33
PACKAGE_NAME=redis_cache
4-
DJANGO_VERSION?=>=1.11,<3.2
4+
DJANGO_VERSION?=>=1.11,<4.0
55

66
.PHONY: install_requirements
77
install_requirements: requirements*.txt
@@ -21,8 +21,8 @@ clean:
2121

2222
.PHONY: test
2323
test: install_requirements
24-
PYTHONPATH=$(PYTHONPATH): django-admin.py test --settings=tests.settings -s
24+
PYTHONPATH=$(PYTHONPATH): django-admin test --settings=tests.settings -s
2525

2626
.PHONY: shell
2727
shell:
28-
PYTHONPATH=$(PYTHONPATH): django-admin.py shell --settings=tests.settings
28+
PYTHONPATH=$(PYTHONPATH): django-admin shell --settings=tests.settings

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Docs can be found at http://django-redis-cache.readthedocs.org/en/latest/.
2121
Changelog
2222
=========
2323

24+
X.Y.Z
25+
-----
26+
27+
* Confirms support for Django 3.2 (no code changes required).
2428

2529
3.0.0
2630
-----

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"Framework :: Django",
2424
"Framework :: Django :: 3.0",
2525
"Framework :: Django :: 3.1",
26+
"Framework :: Django :: 3.2",
2627
],
2728
)

tests/testapp/tests/base_tests.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
except ImportError:
1414
import pickle
1515

16+
import django
1617
from django.core.cache import caches
1718
from django.core.exceptions import ImproperlyConfigured
1819
from django.test import TestCase, override_settings
@@ -125,7 +126,12 @@ def setUp(self):
125126

126127
def tearDown(self):
127128
# clear caches to allow @override_settings(CACHES=...) to work.
128-
caches._caches.caches = {}
129+
if django.VERSION < (3, 2):
130+
caches._caches.caches = {}
131+
else:
132+
for alias in caches:
133+
if hasattr(caches._connections, alias):
134+
del caches[alias]
129135
# Sometimes it will be necessary to skip this method because we need to
130136
# test default initialization and that may be using a different port
131137
# than the test redis server.

tests/testapp/tests/master_slave_tests.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import time
22

3+
import django
34
from django.core.cache import caches
45
from django.test import TestCase, override_settings
56

@@ -36,9 +37,11 @@ def setUp(self):
3637
pool.reset()
3738

3839
def test_master_client(self):
39-
# Reset the caches at the beginning of the test.
40-
caches._caches.caches = {}
41-
40+
# Reset the cache at the beginning of the test.
41+
if django.VERSION < (3, 2):
42+
del caches._caches.caches['default']
43+
else:
44+
del caches['default']
4245
cache = self.get_cache()
4346
client = cache.master_client
4447
self.assertEqual(

0 commit comments

Comments
 (0)