Skip to content

Commit 8bda536

Browse files
authored
Merge pull request #58 from ronardcaktus/upgrade-python-django
Upgrade python & django
2 parents f984772 + 25fc192 commit 8bda536

File tree

8 files changed

+37
-115
lines changed

8 files changed

+37
-115
lines changed

.github/workflows/ci.yml

+15-32
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,26 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
versions:
15-
- python: 3.5
16-
toxenv: py35-2.2.X
17-
- python: 3.6
18-
toxenv: py36-2.2.X
19-
- python: 3.7
20-
toxenv: py37-2.2.X
2115
- python: 3.8
22-
toxenv: py38-2.2.X
23-
- python: 3.9
24-
toxenv: py39-2.2.X
25-
26-
- python: 3.6
27-
toxenv: py36-3.0.X
28-
- python: 3.7
29-
toxenv: py37-3.0.X
16+
toxenv: py38-3.2.X
3017
- python: 3.8
31-
toxenv: py38-3.0.X
32-
- python: 3.9
33-
toxenv: py39-3.0.X
34-
35-
- python: 3.6
36-
toxenv: py36-3.1.X
37-
- python: 3.7
38-
toxenv: py37-3.1.X
18+
toxenv: py38-4.0.X
3919
- python: 3.8
40-
toxenv: py38-3.1.X
41-
- python: 3.9
42-
toxenv: py39-3.1.X
43-
44-
- python: 3.6
45-
toxenv: py36-3.2.X
46-
- python: 3.7
47-
toxenv: py37-3.2.X
48-
- python: 3.8
49-
toxenv: py38-3.2.X
20+
toxenv: py38-4.2.X
21+
5022
- python: 3.9
5123
toxenv: py39-3.2.X
24+
- python: 3.9
25+
toxenv: py39-4.0.X
26+
- python: 3.9
27+
toxenv: py39-4.2.X
28+
29+
- python: "3.10"
30+
toxenv: py310-3.2.X
31+
- python: "3.10"
32+
toxenv: py310-4.0.X
33+
- python: "3.10"
34+
toxenv: py310-4.2.X
5235

5336
runs-on: ubuntu-latest
5437
steps:

.travis.yml

-64
This file was deleted.

multidb/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ class PinningReplicaRouter(ReplicaRouter):
139139
140140
"""
141141
def db_for_read(self, model, **hints):
142-
"""Send reads to replicas in round-robin unless this thread is "stuck" to
143-
the master."""
142+
"""Send reads to replicas in round-robin unless this thread is
143+
"stuck" to the master."""
144144
return DEFAULT_DB_ALIAS if this_thread_is_pinned() else get_replica()
145145

146146

multidb/tests.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,13 @@ class MiddlewareTests(UnpinningTestCase):
124124
def setUp(self):
125125
super(MiddlewareTests, self).setUp()
126126

127+
# Django 4.0 requires response as an arg
128+
# https://stackoverflow.com/questions/62944755/how-to-unittest-new-style-django-middleware
129+
get_response = mock.MagicMock()
130+
127131
# Every test uses these, so they're okay as attrs.
128132
self.request = HttpRequest()
129-
self.middleware = PinningRouterMiddleware()
133+
self.middleware = PinningRouterMiddleware(get_response)
130134

131135
def test_pin_on_cookie(self):
132136
"""Thread should pin when the cookie is set."""

requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
django-nose==1.4.4
2-
flake8==3.3.0
1+
django-nose==1.4.7
2+
flake8==6.0.0

run.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ usage() {
1313

1414
case "$1" in
1515
"test" )
16-
django-admin.py test multidb ;;
16+
django-admin test multidb ;;
1717
"shell" )
18-
django-admin.py shell ;;
18+
django-admin shell ;;
1919
"check" )
2020
flake8 multidb ;;
2121
* )

test_settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# A Django settings module to support the tests
22

33
SECRET_KEY = 'dummy'
4-
TEST_RUNNER = 'django_nose.runner.NoseTestSuiteRunner'
4+
# TEST_RUNNER = 'django_nose.runner.NoseTestSuiteRunner'
55

66
MIDDLEWARE_CLASSES = (
77
'django.middleware.common.CommonMiddleware',

tox.ini

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
[tox]
22
envlist =
33
flake8
4-
{py35,py36,py37,py38,py39}-2.2.X
5-
{py36,py37,py38,py39}-3.0.X
6-
{py36,py37,py38,py39}-3.1.X
7-
{py36,py37,py38,py39}-3.2.X
4+
{py38,py39,py310}-3.2.X
5+
{py38,py39,py310}-4.0.X
6+
{py38,py39,py310}-4.1.X
7+
{py38,py39,py310}-4.2.X
88

99
[testenv]
10+
allowlist_externals=./run.sh
1011
basepython =
11-
py35: python3.5
12-
py36: python3.6
13-
py37: python3.7
1412
py38: python3.8
1513
py39: python3.9
14+
py10: python3.10
1615

1716
commands =
1817
./run.sh test
1918
python --version
20-
django-admin.py --version
19+
django-admin --version
2120
pip freeze
2221

2322
deps =
24-
2.2.X: Django>=2.2,<2.3
25-
3.0.X: Django>=3.0,<3.1
26-
3.1.X: Django>=3.1,<3.2
2723
3.2.X: Django>=3.2,<4.0
24+
4.0.X: Django>=4.0,<4.1
25+
4.1.X: Django>=4.1,<4.2
26+
4.2.X: Django>=4.2,<5.0
2827
-r{toxinidir}/requirements.txt
2928

3029
[testenv:flake8]

0 commit comments

Comments
 (0)