Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade python & django #58

Merged
merged 7 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add quotes around 3.10, otherwise yaml parses it as 3.1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


runs-on: ubuntu-latest
steps:
Expand Down
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
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
Loading