Skip to content

Commit

Permalink
Merge pull request #58 from ronardcaktus/upgrade-python-django
Browse files Browse the repository at this point in the history
Upgrade python & django
  • Loading branch information
diox authored May 16, 2024
2 parents f984772 + 25fc192 commit 8bda536
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 115 deletions.
47 changes: 15 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,26 @@ jobs:
fail-fast: false
matrix:
versions:
- python: 3.5
toxenv: py35-2.2.X
- python: 3.6
toxenv: py36-2.2.X
- python: 3.7
toxenv: py37-2.2.X
- python: 3.8
toxenv: py38-2.2.X
- python: 3.9
toxenv: py39-2.2.X

- python: 3.6
toxenv: py36-3.0.X
- python: 3.7
toxenv: py37-3.0.X
toxenv: py38-3.2.X
- python: 3.8
toxenv: py38-3.0.X
- python: 3.9
toxenv: py39-3.0.X

- python: 3.6
toxenv: py36-3.1.X
- python: 3.7
toxenv: py37-3.1.X
toxenv: py38-4.0.X
- python: 3.8
toxenv: py38-3.1.X
- python: 3.9
toxenv: py39-3.1.X

- python: 3.6
toxenv: py36-3.2.X
- python: 3.7
toxenv: py37-3.2.X
- python: 3.8
toxenv: py38-3.2.X
toxenv: py38-4.2.X

- python: 3.9
toxenv: py39-3.2.X
- python: 3.9
toxenv: py39-4.0.X
- python: 3.9
toxenv: py39-4.2.X

- python: "3.10"
toxenv: py310-3.2.X
- python: "3.10"
toxenv: py310-4.0.X
- python: "3.10"
toxenv: py310-4.2.X

runs-on: ubuntu-latest
steps:
Expand Down
64 changes: 0 additions & 64 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions multidb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ class PinningReplicaRouter(ReplicaRouter):
"""
def db_for_read(self, model, **hints):
"""Send reads to replicas in round-robin unless this thread is "stuck" to
the master."""
"""Send reads to replicas in round-robin unless this thread is
"stuck" to the master."""
return DEFAULT_DB_ALIAS if this_thread_is_pinned() else get_replica()


Expand Down
6 changes: 5 additions & 1 deletion multidb/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,13 @@ class MiddlewareTests(UnpinningTestCase):
def setUp(self):
super(MiddlewareTests, self).setUp()

# Django 4.0 requires response as an arg
# https://stackoverflow.com/questions/62944755/how-to-unittest-new-style-django-middleware
get_response = mock.MagicMock()

# Every test uses these, so they're okay as attrs.
self.request = HttpRequest()
self.middleware = PinningRouterMiddleware()
self.middleware = PinningRouterMiddleware(get_response)

def test_pin_on_cookie(self):
"""Thread should pin when the cookie is set."""
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
django-nose==1.4.4
flake8==3.3.0
django-nose==1.4.7
flake8==6.0.0
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ usage() {

case "$1" in
"test" )
django-admin.py test multidb ;;
django-admin test multidb ;;
"shell" )
django-admin.py shell ;;
django-admin shell ;;
"check" )
flake8 multidb ;;
* )
Expand Down
2 changes: 1 addition & 1 deletion test_settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# A Django settings module to support the tests

SECRET_KEY = 'dummy'
TEST_RUNNER = 'django_nose.runner.NoseTestSuiteRunner'
# TEST_RUNNER = 'django_nose.runner.NoseTestSuiteRunner'

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
Expand Down
21 changes: 10 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
[tox]
envlist =
flake8
{py35,py36,py37,py38,py39}-2.2.X
{py36,py37,py38,py39}-3.0.X
{py36,py37,py38,py39}-3.1.X
{py36,py37,py38,py39}-3.2.X
{py38,py39,py310}-3.2.X
{py38,py39,py310}-4.0.X
{py38,py39,py310}-4.1.X
{py38,py39,py310}-4.2.X

[testenv]
allowlist_externals=./run.sh
basepython =
py35: python3.5
py36: python3.6
py37: python3.7
py38: python3.8
py39: python3.9
py10: python3.10

commands =
./run.sh test
python --version
django-admin.py --version
django-admin --version
pip freeze

deps =
2.2.X: Django>=2.2,<2.3
3.0.X: Django>=3.0,<3.1
3.1.X: Django>=3.1,<3.2
3.2.X: Django>=3.2,<4.0
4.0.X: Django>=4.0,<4.1
4.1.X: Django>=4.1,<4.2
4.2.X: Django>=4.2,<5.0
-r{toxinidir}/requirements.txt

[testenv:flake8]
Expand Down

0 comments on commit 8bda536

Please sign in to comment.