From 93617d0b15e482395f11487ac9dc8ca7805dc969 Mon Sep 17 00:00:00 2001 From: ronardcaktus Date: Wed, 19 Jul 2023 14:46:21 -0400 Subject: [PATCH 1/7] Fix tests locally --- requirements.txt | 4 ++-- run.sh | 4 ++-- tox.ini | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 913c391..d507e8c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -django-nose==1.4.4 -flake8==3.3.0 +django-nose==1.4.7 +flake8==6.0.0 diff --git a/run.sh b/run.sh index 395b4c0..1c42fa9 100755 --- a/run.sh +++ b/run.sh @@ -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 ;; * ) diff --git a/tox.ini b/tox.ini index 8fef433..93a0af2 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,7 @@ envlist = {py36,py37,py38,py39}-3.2.X [testenv] +allowlist_externals=./run.sh basepython = py35: python3.5 py36: python3.6 @@ -17,7 +18,7 @@ basepython = commands = ./run.sh test python --version - django-admin.py --version + django-admin --version pip freeze deps = From dc5bf4eab3f7098257e93421db94d657e0c39bbf Mon Sep 17 00:00:00 2001 From: ronardcaktus Date: Wed, 19 Jul 2023 14:49:33 -0400 Subject: [PATCH 2/7] Fix tests locally --- multidb/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multidb/__init__.py b/multidb/__init__.py index 9541e80..5ac3bdd 100644 --- a/multidb/__init__.py +++ b/multidb/__init__.py @@ -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() From 85b0f9a9b7305363fc7621afc4b1065e7d18183b Mon Sep 17 00:00:00 2001 From: ronardcaktus Date: Mon, 24 Jul 2023 14:37:24 -0400 Subject: [PATCH 3/7] Add support for python3.10 and django4.x+ --- multidb/tests.py | 6 +++++- tox.ini | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/multidb/tests.py b/multidb/tests.py index 125cff4..843d503 100644 --- a/multidb/tests.py +++ b/multidb/tests.py @@ -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.""" diff --git a/tox.ini b/tox.ini index 93a0af2..624afee 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,9 @@ envlist = {py36,py37,py38,py39}-3.0.X {py36,py37,py38,py39}-3.1.X {py36,py37,py38,py39}-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 @@ -14,6 +17,7 @@ basepython = py37: python3.7 py38: python3.8 py39: python3.9 + py10: python3.10 commands = ./run.sh test @@ -26,6 +30,9 @@ deps = 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] From 9d57e4bc5263c636425029b8d28d44c3f8df41a8 Mon Sep 17 00:00:00 2001 From: ronardcaktus Date: Tue, 26 Sep 2023 14:53:18 -0400 Subject: [PATCH 4/7] Add python 3.10 and django 4.x to ci --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57a2078..4f49e20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,11 @@ jobs: toxenv: py38-3.2.X - python: 3.9 toxenv: py39-3.2.X + + - python: 3.10 + toxenv: py310-4.0.X + - python: 3.10 + toxenv: py310-4.2.X runs-on: ubuntu-latest steps: From f9c83c3134cf92d06b3e3bfc0cde8d1fd8e44f59 Mon Sep 17 00:00:00 2001 From: ronardcaktus Date: Tue, 26 Sep 2023 15:24:23 -0400 Subject: [PATCH 5/7] Removed deprecated versions --- .github/workflows/ci.yml | 44 ++++++++++------------------------------ tox.ini | 11 +--------- 2 files changed, 12 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f49e20..cdb39de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,44 +12,22 @@ 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 - - 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-3.2.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 + toxenv: py38-4.0.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 diff --git a/tox.ini b/tox.ini index 624afee..6ffdd31 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,7 @@ [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 @@ -12,9 +9,6 @@ envlist = [testenv] allowlist_externals=./run.sh basepython = - py35: python3.5 - py36: python3.6 - py37: python3.7 py38: python3.8 py39: python3.9 py10: python3.10 @@ -26,9 +20,6 @@ commands = 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 From 1d0885530d9b2eaf1a9aeeb41c4364de9eb43ca7 Mon Sep 17 00:00:00 2001 From: ronardcaktus Date: Tue, 26 Sep 2023 15:31:00 -0400 Subject: [PATCH 6/7] delete travis file and parse py3.10 correctly --- .github/workflows/ci.yml | 6 ++-- .travis.yml | 64 ---------------------------------------- 2 files changed, 3 insertions(+), 67 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdb39de..e36524b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,11 +26,11 @@ jobs: - python: 3.9 toxenv: py39-4.2.X - - python: 3.10 + - python: "3.10" toxenv: py310-3.2.X - - python: 3.10 + - python: "3.10" toxenv: py310-4.0.X - - python: 3.10 + - python: "3.10" toxenv: py310-4.2.X runs-on: ubuntu-latest diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7de3f76..0000000 --- a/.travis.yml +++ /dev/null @@ -1,64 +0,0 @@ -dist: xenial - -sudo: false - -language: python - -matrix: - include: - - python: 3.5 - env: TOX_ENV=ppy35-2.2.X - - - python: 3.6 - env: TOX_ENV=ppy36-2.2.X - - - python: 3.7 - env: TOX_ENV=ppy37-2.2.X - - - python: 3.8 - env: TOX_ENV=ppy38-2.2.X - - - python: 3.9 - env: TOX_ENV=ppy39-2.2.X - - - python: 3.6 - env: TOX_ENV=ppy36-3.0.X - - - python: 3.7 - env: TOX_ENV=ppy37-3.0.X - - - python: 3.8 - env: TOX_ENV=ppy38-3.0.X - - - python: 3.9 - env: TOX_ENV=ppy39-3.0.X - - - python: 3.6 - env: TOX_ENV=ppy36-3.1.X - - - python: 3.7 - env: TOX_ENV=ppy37-3.1.X - - - python: 3.8 - env: TOX_ENV=ppy38-3.1.X - - - python: 3.9 - env: TOX_ENV=ppy39-3.1.X - - - python: 3.6 - env: TOX_ENV=ppy36-3.2.X - - - python: 3.7 - env: TOX_ENV=ppy37-3.2.X - - - python: 3.8 - env: TOX_ENV=ppy38-3.2.X - - - python: 3.9 - env: TOX_ENV=ppy39-3.2.X - -install: - - pip install tox - -script: - - tox -e $TOX_ENV From 25fc19204eef26029d00b9f1afcfbd53305c2ba1 Mon Sep 17 00:00:00 2001 From: ronardcaktus Date: Thu, 16 May 2024 09:24:56 -0400 Subject: [PATCH 7/7] Disable nose runner --- test_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_settings.py b/test_settings.py index 57f3ab2..caa8dc0 100644 --- a/test_settings.py +++ b/test_settings.py @@ -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',