Repository: jazzband/django-axes (python)

Issue:
W003 error in 5.36.0 using AxesStandaloneBackend
Upon upgrading to the latest version, and switching to AxesStandaloneBackend under AUTHENTICATION_BACKENDS, I am getting the W003 error. I've silenced it for now using the info in the docs, but perhaps the config checker needs updating as well?

Pull request:
Use new backend base class in checks
In 5c4bca6cb69ad6d96bfec4df85e15dfe62a1689e a new backend  base class was introduced. However the check and its corresponding tests still reference the old base class, thus triggering a warning on setups using the new backend base class.

resolves #907

Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 99219b6..accda35 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -3,6 +3,20 @@ Changes
 =======
 
 
+5.38.0 (2022-08-16)
+-------------------
+
+- Adjust changelog so release notes are correctly visible on PyPy and released package.
+  [aleksihakli]
+
+
+5.37.0 (2022-08-16)
+-------------------
+
+- Add Django 4.1 support. PyPy 3.8 has a known issue with Django 4.1 and is exempted.
+  [hramezani]
+
+
 5.36.0 (2022-07-17)
 -------------------
 
diff --git a/axes/checks.py b/axes/checks.py
index 249eb22..711bcf8 100644
--- a/axes/checks.py
+++ b/axes/checks.py
@@ -5,7 +5,7 @@ from django.core.checks import (  # pylint: disable=redefined-builtin
 )
 from django.utils.module_loading import import_string
 
-from axes.backends import AxesBackend
+from axes.backends import AxesStandaloneBackend
 from axes.conf import settings
 
 
@@ -19,16 +19,14 @@ class Messages:
     MIDDLEWARE_INVALID = (
         "You do not have 'axes.middleware.AxesMiddleware' in your settings.MIDDLEWARE."
     )
-    BACKEND_INVALID = "You do not have 'axes.backends.AxesBackend' or a subclass in your settings.AUTHENTICATION_BACKENDS."
+    BACKEND_INVALID = "You do not have 'axes.backends.AxesStandaloneBackend' or a subclass in your settings.AUTHENTICATION_BACKENDS."
     SETTING_DEPRECATED = "You have a deprecated setting {deprecated_setting} configured in your project settings"
 
 
 class Hints:
     CACHE_INVALID = None
     MIDDLEWARE_INVALID = None
-    BACKEND_INVALID = (
-        "AxesModelBackend was renamed to AxesBackend in django-axes version 5.0."
-    )
+    BACKEND_INVALID = "AxesModelBackend was renamed to AxesStandaloneBackend in django-axes version 5.0."
     SETTING_DEPRECATED = None
 
 
@@ -101,7 +99,7 @@ def axes_backend_check(app_configs, **kwargs):  # pylint: disable=unused-argumen
                 "Can not import backend class defined in settings.AUTHENTICATION_BACKENDS"
             ) from e
 
-        if issubclass(backend, AxesBackend):
+        if issubclass(backend, AxesStandaloneBackend):
             found = True
             break
 
diff --git a/pyproject.toml b/pyproject.toml
index 1deebea..c711449 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,6 +12,7 @@ legacy_tox_ini = """
 envlist =
     py{37,38,39,310,py38}-dj32
     py{38,39,310,py38}-dj40
+    py{38,39,310,py38}-dj41
     py{38,39,310,py38}-djmain
     py310-djqa
 
@@ -27,6 +28,7 @@ python =
 DJANGO =
     3.2: dj32
     4.0: dj40
+    4.1: dj41
     main: djmain
     qa: djqa
 
@@ -36,6 +38,7 @@ deps =
     -r requirements-test.txt
     dj32: django>=3.2,<3.3
     dj40: django>=4.0,<4.1
+    dj41: django>=4.1,<4.2
     djmain: https://github.com/django/django/archive/main.tar.gz
 usedevelop = true
 commands = pytest
@@ -44,8 +47,10 @@ setenv =
 # Django development version is allowed to fail the test matrix
 ignore_outcome =
     djmain: True
+    pypy38-dj41: True
 ignore_errors =
     djmain: True
+    pypy38-dj41: True
 
 # QA runs type checks, linting, and code formatting checks
 [testenv:py310-djqa]
diff --git a/setup.py b/setup.py
index d05cc01..db2f245 100644
--- a/setup.py
+++ b/setup.py
@@ -46,6 +46,7 @@ setup(
         "Framework :: Django",
         "Framework :: Django :: 3.2",
         "Framework :: Django :: 4.0",
+        "Framework :: Django :: 4.1",
         "Intended Audience :: Developers",
         "Intended Audience :: System Administrators",
         "License :: OSI Approved :: MIT License",


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 2afdd30..5972a39 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -14,7 +14,7 @@ jobs:
       max-parallel: 5
       matrix:
         python-version: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.8']
-        django-version: ['3.2', '4.0']
+        django-version: ['3.2', '4.0', '4.1']
         include:
           # Tox configuration for QA environment
           - python-version: '3.10'
@@ -29,6 +29,9 @@ jobs:
           - python-version: '3.10'
             django-version: 'main'
             experimental: true
+          - python-version: 'pypy-3.8'
+            django-version: '4.1'
+            experimental: true
           - python-version: 'pypy-3.8'
             django-version: 'main'
             experimental: true
@@ -36,6 +39,8 @@ jobs:
           # Exclude Python 3.7 for Django 4.0 and Django main
           - python-version: '3.7'
             django-version: '4.0'
+          - python-version: '3.7'
+            django-version: '4.1'
           - python-version: '3.7'
             django-version: 'main'
 
diff --git a/requirements-test.txt b/requirements-test.txt
index 52e4092..3c3f8d3 100644
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -1,5 +1,5 @@
 -e .
-coverage==6.4.2
+coverage==6.4.4
 pytest==7.1.2
 pytest-cov==3.0.0
 pytest-django==4.5.2
diff --git a/tests/settings.py b/tests/settings.py
index 949aad8..b378fea 100644
--- a/tests/settings.py
+++ b/tests/settings.py
@@ -20,7 +20,7 @@ MIDDLEWARE = [
 ]
 
 AUTHENTICATION_BACKENDS = [
-    "axes.backends.AxesBackend",
+    "axes.backends.AxesStandaloneBackend",
     "django.contrib.auth.backends.ModelBackend",
 ]
 
diff --git a/tests/test_checks.py b/tests/test_checks.py
index 594c2a7..1ccad7c 100644
--- a/tests/test_checks.py
+++ b/tests/test_checks.py
@@ -1,7 +1,7 @@
 from django.core.checks import run_checks, Warning  # pylint: disable=redefined-builtin
 from django.test import override_settings, modify_settings
 
-from axes.backends import AxesBackend
+from axes.backends import AxesStandaloneBackend
 from axes.checks import Messages, Hints, Codes
 from tests.base import AxesTestCase
 
@@ -58,12 +58,14 @@ class MiddlewareCheckTestCase(AxesTestCase):
         self.assertEqual(warnings, [warning])
 
 
-class AxesSpecializedBackend(AxesBackend):
+class AxesSpecializedBackend(AxesStandaloneBackend):
     pass
 
 
 class BackendCheckTestCase(AxesTestCase):
-    @modify_settings(AUTHENTICATION_BACKENDS={"remove": ["axes.backends.AxesBackend"]})
+    @modify_settings(
+        AUTHENTICATION_BACKENDS={"remove": ["axes.backends.AxesStandaloneBackend"]}
+    )
     def test_backend_missing(self):
         warnings = run_checks()
         warning = Warning(