]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
requirements: Bump Django to 3.2.x, django-filter to 21.1
authorStephen Finucane <stephen@that.guru>
Wed, 29 Sep 2021 14:44:04 +0000 (15:44 +0100)
committerStephen Finucane <stephen@that.guru>
Wed, 29 Sep 2021 16:15:59 +0000 (17:15 +0100)
It seems the ORM is now smarter and requires less JOINs that previously
in two tests. In addition, a new setting is required to ensure the type
of our primary field columns doesn't change when Django 4.0 is released.

We drop support for Django 3.1 in the process, though this doesn't have
much of a real-world impact since we still support Django 2.2, an LTS
release.

Signed-off-by: Stephen Finucane <stephen@that.guru>
patchwork/settings/base.py
patchwork/tests/api/test_event.py
patchwork/tests/api/test_patch.py
releasenotes/notes/django-3-2-support-363b32e74bdcf017.yaml [new file with mode: 0644]
requirements-dev.txt
requirements-prod.txt
tox.ini

index c1bb9b27fac8a00ed22e0e34d7794e4d95b1b4b4..ff14d91b8ff46d771fd28177a35346a199e43f93 100644 (file)
@@ -68,6 +68,10 @@ TEMPLATES = [
     },
 ]
 
+# TODO(stephenfin): Consider changing to BigAutoField when we drop support for
+# Django < 3.2
+DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
+
 DEFAULT_FROM_EMAIL = 'Patchwork <patchwork@patchwork.example.com>'
 
 SERVER_EMAIL = DEFAULT_FROM_EMAIL
index 32e99366654634f0d89eeb540ba9f099eb744bdb..62506a5b0b84577784f9b154c489bb8f971409fb 100644 (file)
@@ -5,6 +5,7 @@
 
 import unittest
 
+import django
 from django.conf import settings
 from django.urls import reverse
 
@@ -187,7 +188,10 @@ class TestEventAPI(utils.APITestCase):
         for _ in range(3):
             self._create_events()
 
-        with self.assertNumQueries(28):
+        # TODO(stephenfin): Remove when we drop support for Django < 3.2
+        num_queries = 28 if django.VERSION < (3, 2) else 27
+
+        with self.assertNumQueries(num_queries):
             self.client.get(self.api_url())
 
     def test_order_by_date_default(self):
index 1c61640921a926faccb7076cab656d8129e2b430..36c3e5f92a1fb6c7fd5b1ac04db60558fae5acbc 100644 (file)
@@ -7,6 +7,7 @@ import email.parser
 from email.utils import make_msgid
 import unittest
 
+import django
 from django.conf import settings
 from django.urls import NoReverseMatch
 from django.urls import reverse
@@ -228,7 +229,10 @@ class TestPatchAPI(utils.APITestCase):
         series = create_series()
         create_patches(5, series=series)
 
-        with self.assertNumQueries(7):
+        # TODO(stephenfin): Remove when we drop support for Django < 3.2
+        num_queries = 7 if django.VERSION < (3, 2) else 5
+
+        with self.assertNumQueries(num_queries):
             self.client.get(self.api_url())
 
     @utils.store_samples('patch-detail')
diff --git a/releasenotes/notes/django-3-2-support-363b32e74bdcf017.yaml b/releasenotes/notes/django-3-2-support-363b32e74bdcf017.yaml
new file mode 100644 (file)
index 0000000..039535e
--- /dev/null
@@ -0,0 +1,9 @@
+---
+features:
+  - |
+    `Django 3.2 <https://docs.djangoproject.com/en/dev/releases/3.2/>`_ is now
+    supported.
+upgrade:
+  - |
+    Django 3.1 is no longer supported. It is no longer supported upstream and
+    most distributions provide a newer version.
index d58dfaa971e2c4cbfa96b4dbca32392aeb18a922..437b1e8bf2f59f85b0adfa0ec7c6e549bf196927 100644 (file)
@@ -1,6 +1,6 @@
-Django~=3.1.0
+Django~=3.2.0
 djangorestframework~=3.12.0
-django-filter~=2.4.0
+django-filter~=21.1.0
 django-debug-toolbar~=3.2.0
 django-dbbackup~=3.3.0
 -r requirements-test.txt
index 6bac4d6a366cb6893fe151405599b57bdc95d35b..fa6bc95f5e2b1f3dd9b37c047b2fa54f50bc0382 100644 (file)
@@ -1,5 +1,5 @@
-Django~=3.1.0
+Django~=3.2.0
 djangorestframework~=3.12.0
-django-filter~=2.4.0
+django-filter~=21.1.0
 psycopg2-binary~=2.8.0
 sqlparse~=0.4.0
diff --git a/tox.ini b/tox.ini
index 46d72517dcc4d0e784680616d9479cd9b1242c41..8eab01da2fc990f4f3840b4a6b26a4db6511b83d 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
 [tox]
 minversion = 3.2
-envlist = pep8,docs,py{36,37,38,39}-django{22,30,31}
+envlist = pep8,docs,py{36,37,38,39}-django{22,31,32}
 skipsdist = true
 ignore_basepython_conflict = true
 
@@ -10,13 +10,13 @@ deps =
     -r{toxinidir}/requirements-test.txt
     django22: django>=2.2,<2.3
     django22: djangorestframework>=3.10,<3.13
-    django22: django-filter>=2.1,<3.0
-    django30: django>=3.0,<3.1
-    django30: djangorestframework>=3.10,<3.13
-    django30: django-filter>=2.2,<3.0
+    django22: django-filter~=21.1.0
     django31: django>=3.1,<3.2
     django31: djangorestframework>=3.10,<3.13
-    django31: django-filter>=2.3,<3.0
+    django31: django-filter~=21.1.0
+    django32: django>=3.2,<3.3
+    django32: djangorestframework>=3.10,<3.13
+    django32: django-filter~=21.1.0
 setenv =
     DJANGO_SETTINGS_MODULE = patchwork.settings.dev
     PYTHONDONTWRITEBYTECODE = 1