Skip to content

Commit

Permalink
Confirm support for Django 3.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixxm committed Mar 9, 2022
1 parent 86e5434 commit 01260d5
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ python:
env:
- DJANGO_VERSION='>=3.0,<3.1'
- DJANGO_VERSION='>=3.1,<3.2'
- DJANGO_VERSION='>=3.2,<4.0'
# command to run tests
install: ./install_redis.sh
script: make test DJANGO_VERSION=$DJANGO_VERSION
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL := /bin/bash

PACKAGE_NAME=redis_cache
DJANGO_VERSION?=>=1.11,<3.2
DJANGO_VERSION?=>=1.11,<4.0

.PHONY: install_requirements
install_requirements: requirements*.txt
Expand All @@ -21,8 +21,8 @@ clean:

.PHONY: test
test: install_requirements
PYTHONPATH=$(PYTHONPATH): django-admin.py test --settings=tests.settings -s
PYTHONPATH=$(PYTHONPATH): django-admin test --settings=tests.settings -s

.PHONY: shell
shell:
PYTHONPATH=$(PYTHONPATH): django-admin.py shell --settings=tests.settings
PYTHONPATH=$(PYTHONPATH): django-admin shell --settings=tests.settings
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Docs can be found at http://django-redis-cache.readthedocs.org/en/latest/.
Changelog
=========

X.Y.Z
-----

* Confirms support for Django 3.2 (no code changes required).

3.0.0
-----
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"Framework :: Django",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
],
)
8 changes: 7 additions & 1 deletion tests/testapp/tests/base_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
except ImportError:
import pickle

import django
from django.core.cache import caches
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, override_settings
Expand Down Expand Up @@ -125,7 +126,12 @@ def setUp(self):

def tearDown(self):
# clear caches to allow @override_settings(CACHES=...) to work.
caches._caches.caches = {}
if django.VERSION < (3, 2):
caches._caches.caches = {}
else:
for alias in caches:
if hasattr(caches._connections, alias):
del caches[alias]
# 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 Down
9 changes: 6 additions & 3 deletions tests/testapp/tests/master_slave_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time

import django
from django.core.cache import caches
from django.test import TestCase, override_settings

Expand Down Expand Up @@ -36,9 +37,11 @@ def setUp(self):
pool.reset()

def test_master_client(self):
# Reset the caches at the beginning of the test.
caches._caches.caches = {}

# Reset the cache at the beginning of the test.
if django.VERSION < (3, 2):
del caches._caches.caches['default']
else:
del caches['default']
cache = self.get_cache()
client = cache.master_client
self.assertEqual(
Expand Down

0 comments on commit 01260d5

Please sign in to comment.