From 29884feeb921d5f7263308c08e8821a0f9fbeae2 Mon Sep 17 00:00:00 2001 From: "T. Franzel" Date: Mon, 20 Nov 2023 23:33:14 +0100 Subject: [PATCH] fix allauth drop of 3.6 support --- requirements/optionals.txt | 5 +++-- tests/conftest.py | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/requirements/optionals.txt b/requirements/optionals.txt index d64df878..1a1c4ad4 100644 --- a/requirements/optionals.txt +++ b/requirements/optionals.txt @@ -1,6 +1,7 @@ -django-allauth>=0.56.0 +django-allauth>=0.56.0; python_version >= '3.7' +django-allauth<0.55.0; python_version < '3.7' drf-jwt>=0.13.0 -dj-rest-auth>=5.0.2 +dj-rest-auth>=1.0.0 djangorestframework-simplejwt>=4.4.0 django-polymorphic>=2.1 django-rest-polymorphic>=0.1.8 diff --git a/tests/conftest.py b/tests/conftest.py index c4d53a89..d928f660 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -32,6 +32,11 @@ def pytest_configure(config): if is_gis_installed(): contrib_apps.append('rest_framework_gis') + contrib_middleware = [] + + if module_available('allauth.account.middleware'): + contrib_middleware.append('allauth.account.middleware.AccountMiddleware') + base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) settings.configure( @@ -70,7 +75,7 @@ def pytest_configure(config): 'django.middleware.common.CommonMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.locale.LocaleMiddleware', - 'allauth.account.middleware.AccountMiddleware', + *contrib_middleware, ), INSTALLED_APPS=( 'django.contrib.auth',